bh-envwrapper
v1.3.2
Published
This service search and return a determinist env values from host
Downloads
10
Readme
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: '[email protected]', port: '999' },
api: { host: '[email protected]' }
},
redin:
{
fifo: { port: '999' },
api: { port: '666' }
}
}
console.log(results.carnage.fifo.host) // [email protected]
console.log(results.carnage.api) // { host: '[email protected]' }
console.log(results.redin.api) // { port: '666' }