Core
Write Plugins v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

init function #

Plugins must expose an init function. If it is missing, Kuzzle fails to load the plugin and aborts its start sequence.

The init method is called once during startup, and it is used to initialize the plugin.

Arguments #

Copied to clipboard!
init(config, context);

Arguments Type Description
config
object
Contains the custom plugin configuration (see the configuration chapter)
context
object
The plugin context, exposing various accessors, constructors, and helpers. The other sections of this documentation detail the interfaces made available by this object

Return #

The init function can optionally return a promise. If it does, Kuzzle waits for the promise to be resolved before continuing its own initialization.

If a promise is returned, it must be resolved within the configured timeout (see plugins.common.initTimeout in Kuzzle's configuration)

If a promise is returned and rejected, or if the init function throws an error, Kuzzle aborts its start sequence and shuts down.