Closed sikancil closed 7 years ago
options
here https://gist.github.com/sikancil/71f0c07d699cdbe248c243e48913fbbf#file-server-js-L60-L69 should be a sibling of plugin property, not a child. i.e. it should be:
registrations: [
{
plugin: 'inert' ,
options: {
select: 'web'
}
},
{
plugin: 'vision',
options: {
select: 'api'
}
}
]
@mtharrison Thanks dude, it help much! gist updated.
var newPluginRegistration = {
//-- place the module/hapi-plugin name as string,
// it will call in background as `required(module_name)`
plugin: pluginName,
//-- the options will passing into server.register() options
options: {
select: [instance.name]
}
};
as mentioned by @mtharrison :
registrations: [
{ plugin: 'inert', options: { select: [ 'Connection_A', 'Connection_B' ] } },
{ plugin: 'hapi-auth-jwt2', options: { select: [ 'Connection_A' ] } },
{ plugin: 'yar', options: { select: [ 'Connection_A' ] } },
{ plugin: 'vision', options: { select: [ 'Connection_B' ] } }
]
and when we check into each connections (eg: server.select('Connection_A').registrations
)
[i] Activated plugins on "Connection_A" connection: [ inert, hapi-auth-jwt2, yar ]
[i] Activated plugins on "Connection_B" connection: [ inert, vision ]
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.
results on each connection by check from here:
Why it's applied all plugins into all connections? Have I done something wrong?
Glue
v4.0.0
. Hapiv15.1.1
.@csrl or anybody.. Please take a look the details I had tried on my gist: https://gist.github.com/sikancil/71f0c07d699cdbe248c243e48913fbbf
file: server.js
line: 200 ~ 208