Open FGRibreau opened 7 years ago
Category: configuration
common-env common-env configuration through environment variables finally done right.
// test.js const env = require('common-env')(); // also try: // const env = require('common-env/withLogger')(console); const config = env.getOrElseAll({ amqp: { login: 'guest', password: 'guest', host: 'localhost', port: 5672 } }); console.log(config.amqp.port); // number
AMQP_PORT=1010 node test.js
It's DRY, it follows 12 factors (no configuration files), it supports default values, variable arrays, automatic type conversion, password protection everything that is a constant in your code can use it... easy right?
Nice, what do you feel about cross-env?
cross-env
@hemanth both will work together indeed and don't do the same thing :)
Category: configuration
It's DRY, it follows 12 factors (no configuration files), it supports default values, variable arrays, automatic type conversion, password protection everything that is a constant in your code can use it... easy right?