Closed danielb2 closed 8 years ago
No, they are both valid. And have two different meanings. Whatever you can pass to the server.register function, you can put into the configuration. Here is the full expanded example:
{
registrations: [
{
plugin: {
register: 'pluginname',
options: {}
},
options: {}
}
]
}
The first options is the plugin options (eg. the options passed to the plugin). The second is the registration options (eg. the 2nd parameter to server.register())
My point here was that both options don't appear to be described in the documentation. Or did I miss one?
The documentation for the registrations array is such:
registrations
- an array of objects holding entries to register with server.register(plugin, [options], callback). Each object has two fields that map directly to the server.register
named parameters:
plugin
- Glue will parse the entry and replace any plugin function field specified as a string by calling require()
with that string. The array form of this parameter accepted by server.register()
is not allowed; use multiple registration objects instead.options
- optional option object passed to server.register()
.It doesn't explicitly document the registration plugin
value, as that is defined by hapi. I see no reason to duplicate hapi's documentation. Same goes for registration option
value. There is a link to the hapi registration
function api documentation for reference.
However, you aren't the first to express that the doc is unclear. I'm open to a pull request, but I'd like to not duplicate hapi's documentation. The form glue has currently taken is to be as transparent of a wrapper to the hapi api as possible. You have to understand hapi api in order to create a glue manifest.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
For the registrations array, reading the documentation:
It reads like the format is:
however, according to the example, it reads:
Since it appears that both formats work, is one deprecated?
Regarding the example format, it seems to me that it is redundant to say
plugin
or is there something else that can be registered?