bh-envwrapper

1.3.2 • Public • Published

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' }

Readme

Keywords

Package Sidebar

Install

npm i bh-envwrapper

Weekly Downloads

2

Version

1.3.2

License

ISC

Unpacked Size

13 kB

Total Files

7

Last publish

Collaborators

  • bht