The RoboHydra configuration file is a JSON file with the list of plugins to load, SSL information if you want RoboHydra to use the HTTPS protocol when responding to requests, and information about the RoboHydra summoner.
A basic configuration file with a simple list of plugins looks like this:
{"plugins": ["logger", "replayer"]}
Each element in the plugins
list in the configuration file can be
one of two things:
name
and config
. The
former specifies the name of the plugin to load, while the latter
specifies a Javascript object with the configuration keys and values
you want to pass to the plugin.config
to an empty object.For example, a RoboHydra configuration file loading a plugin logger
without special configuration and a plugin named my-plugin
with the
configuration keys path
and logLevel
could be:
{"plugins": ["logger",
{"name": "my-plugin",
"config": {"path": "/var/log/example.log",
"logLevel": "warn"}}]}
If you want RoboHydra to use the HTTPS protocol, ie. to respond to SSL
requests, you have to set the secure
property to true
, and the
property sslOptions
to an object with the properties key
and
cert
specifying the paths to the files containing the secret key and
the server certificate respectively. An example configuration file for
an HTTPS server could be:
{"secure": true,
"sslOptions": {"key": "my-key.pem",
"cert": "my-cert.pem"},
"plugins": ["logger"]}
When you use summoners and have more than one plugin
that specifies a hydra picker, you need to specify in the
configuration file which of the plugins contains the picker to be used
(because you can only use one!). You do so by setting the
configuration key summoner
to an object with the property
hydraPickerPlugin
set to the name of that plugin. For example:
{"plugins": ["plugin-with-picker", "another-plugin-with-picker", "moar"],
"summoner": {"hydraPickerPlugin": "plugin-with-picker"}}
Specifying a plugin that doesn’t define any picker will result in an
error. On the other hand, if you only load one plugin that defines a
picker, there’s no need to specify hydraPickerPlugin
in the
configuration file.
Back to the documentation index.