PDK

    As of this release, the PDK has not yet reached 1.0.0, but plugin authors can already depend on it for a safe and reliable way of interacting with the request, response, or the core components.

    The Plugin Development Kit is accessible from the global variable, and various functionalities are namespaced under this table, such as kong.request, kong.log, etc…

    A human-readable string containing the version number of the currently running node.

    Usage

    Back to top

    kong.version_num

    An integral number representing the version number of the currently running node, useful for comparison and feature-existence checks.

    Usage

    1. end

    Back to top

    kong.pdk_major_version

    A number representing the major version of the current PDK (e.g. 1). Useful for feature-existence checks or backwards-compatible behavior as users of the PDK.

    Usage

    Back to top

    Usage

    1. print(kong.pdk_version) -- "1.0.0"

    kong.configuration

    A read-only table containing the configuration of the current Kong node, based on the configuration file and environment variables.

    See for details.

    Comma-separated lists in that file get promoted to arrays of strings in this table.

    Usage

    Back to top

    kong.db

    Instance of Kong’s DAO (the module). Contains accessor objects to various entities.

    A more thorough documentation of this DAO and new schema definitions is to be made available in the future.

    Usage

    1. kong.db.services:insert()
    2. kong.db.routes:select()

    Back to top

    Note: usage of this module is currently reserved to the core or to advanced users.

    kong.worker_events

    Instance of Kong’s IPC module for inter-workers communication from the module.

    Note: usage of this module is currently reserved to the core or to advanced users.

    Back to top

    kong.cluster_events

    Instance of Kong’s cluster events module for inter-nodes communication.

    Note: usage of this module is currently reserved to the core or to advanced users.

    Back to top

    Instance of Kong’s database caching object, from the kong.cache module.

    Note: usage of this module is currently reserved to the core or to advanced users.