1.3.2 • Published 6 years ago
bh-envwrapper v1.3.2
BH-NODEJs Modules - EnvWrapper
Call wrapEnv() with an object like :
options = {
"carnage": { //ServiceName
fifo: ["port"], //serviceType: [mandatory...]
api: []
},
"redin_f1": {
fifo: ["port"],
//api: ["port"]
},
"f1": {
fifo: ["port"],
//api: ["port"]
},
"syren_overflow": {
fifo: ["port"],
//api: ["port"]
},
"syren_apport_ne": {
fifo: ["port"],
//api: ["port"]
}
};
An Exception is throw if a mandatory isn't fulfilled.
Return Object type :
let results = wrapEnv(options);
console.log(results)
==>
{
carnage:
{
fifo: { host: 'leclerc.steven@fifo.host', port: '999' },
api: { host: 'leclerc.steven@api.host' }
},
redin:
{
fifo: { port: '999' },
api: { port: '666' }
}
}
console.log(results.carnage.fifo.host) // leclerc.steven@fifo.host
console.log(results.carnage.api) // { host: 'leclerc.steven@api.host' }
console.log(results.redin.api) // { port: '666' }
1.3.2
6 years ago