Simple Node.js Configloader
github.com/arefm/node-configloader
node-configloader works with 3 different config file (all in json format). the common.cfg.json is the main one. production.cfg.json and development.cfg.json are other files which are required when application environment is set to production or development. all these 3 files are placed into node-configloader directory but you can change path manually.
$ npm i node-configloader
var configs = require("node-configloader");
// all settings
var all = configs.get();
// only one object
var serverConfigs = configs.get("app.server");
configs.setPath('/home/user/projects/configs_directory');
// development
configs.setEnv('development');
// production
configs.setEnv('production');
configs.set({
app: {
server: {
port: 4000
}
}
});