I use nconf to handle configuration in my application. The way I configure it is as follows:
nconf.env({ separator: '__', whitelist: ['foo', 'bar'] }) .file('config.json')
It seems like I cannot change the values if they were obtained through an environment variable. For instance,
console.log(nconf.get()); // {"foo":123,"bar":356} nconf.set('foo', 789); console.log(nconf.get()); // {"foo":123,"bar":356}
I checked the stores nconf attribute and seemed to suggest that env variables are read-only?
console.log(nconf.stores); /** * { env: * { type: 'env', * store: { foo: [Object] }, * mtimes: { 'foo': 1372348332705 }, * readOnly: true, <-- here * loadFrom: null, * whitelist: * ...
Is it possible to change the variables set with env variables at runtime? If I set the values that were set using the config.json file, I can change the values without any problems.
Any help is much appreciated :-)
source share