inheritable-config
v1.1.0
Published
Configuration control for production node deployments
Downloads
6
Maintainers
Readme
Configure your Node.js Applications
Introduction
inheritable-node-config
is forked and extended version of Lorentwest's node-config. It provides inheritance function between config files by naming the config file name like docker:development.js
. Is also allows multi extends by naming it as docker:development,docker-base.js
.
Inheitance example
docker:developmet,docker-base.js
inherits development.js
and docker-base.js
. In this case development.js
is overwritten by docker-base
because docker-base
is right side of development
.
NODE_ENV: docker:development,docker-base
./config/default.js
module.exports = {
mongodb: {
port: 27017
}
};
./config/development.js
module.exports = {
redis: {
host: 'localhost',
port: 2000
},
mongodb: {
host: 'localhost'
}
};
./config/docker-base.js
module.exports = {
redis: {
host: 'redis'
},
mongodb: {
host: 'mongo'
}
};
./config/docker:development,docker-base.js
module.exports = {
label: 'docker:dev'
};
index.js
var config = require('inheritable-config');
console.log(config);
/*
{
label: 'docker:dev',
redis: {
host: 'redis',
port: 2000
},
mongodb: {
host: 'mongo',
port: 27017
}
}
*/
License
May be freely distributed under the MIT license.
Copyright (c) 2018 hshan, Loren West and other contributors