config-resolver
Installation
npm install nfs-config-resolver --save
Usage Example
Create configs
folder within your project directory
Create common.js
development.js
production.js
files inside configs
directory
// common.js
module.exports = {
"host":"localhost",
"port":80
};
prefix key with @
to allow a parameter to be overriden with environment parameter
// development.js
module.exports = {
"port":81,
"mongodb":{
"@host:MONGO_HOST": "localhost"
"@port:MONGO_PORT": "27017"
},
"@mode": "admin"
};
// production.js
module.exports = {
"port":82
};
How to use
You can override configuration with environment parameter
const config = require('nfs-config-resolver')();
console.log(config)
const config = require('nfs-config-resolver')();
console.log(config.port)