Addon module
Flamingo addons only interact with the base flamingo installation using specified hooks, ie.: `"ENV", "CONF", "PROFILES", "ROUTES", "HAPI_PLUGINS"`.
Each hook inside an addon must return a function that returns an expected value. To make it easier to change hook names,
use the exported `HOOKS` from the `src/addon.js` module (ie. `addon.HOOK.CONF`).
- Source:
Members
(static, readonly) HOOKS :string
Hooks to register flamino addon functionality.
Type:
- string
Properties:
Name | Type | Description |
---|---|---|
ENV |
string | Hook that allows you to extend environment variable parsing. It must export a function that returns an array of configurations, compatible with the `src/util/env-config.js` module. See the `env-config` module documentation for more information. |
CONF |
string | Hook that hook allows you to set default parameter for your addon. It must export a function that returns an object. It will merge the addon config object with the flamingo config (`config.js`). |
PROFILES |
string | Hook that allows you to register additional profiles that are available inside the profile conversion route (`src/routes/profile.js`). It must export a function that returns an object. |
ROUTES |
string | Hook that allows you to register additional hapi routes. It must export a function that returns an array of route registration objects |
HAPI_PLUGINS |
string | Hook that allows you to register additional hapi plugins. It must export a function that returns an array of plugin registrations. |
LOG_STREAM |
string | Hook that allows you to register additional bunyan log streams. Note: As of now, it can't add logs that were generated before the addon is initialized to the addon stream. |
EXTRACT_PROCESS |
string | Hook that allows you to modify the result from the convert routes `extractProcess` method. Useful for i.e. modifying the pipe function that converts the image stream. Example adds an Authorization header to the process response. |
- Source: