nconf
nconf copied to clipboard
nconf should always be writable
Why does the following code output 1 instead of 2 ? (nconf version = 0.7.1)
'use strict';
var conf = require('nconf');
conf.defaults({
bingo: 1,
});
conf.set('bingo', 2);
console.log(conf.get('bingo'));
It does work correctly if one specifies memory storage. I gess the set becomes sync in that case. Does it mean the set is async by default ? Is there any doc anywhere on this ?
'use strict';
var conf = require('nconf');
conf.use('memory');
conf.defaults({
bingo: 1,
});
conf.set('bingo', 2);
console.log(conf.get('bingo'));
var conf = require('nconf');
conf.set('foo', 1);
console.log(conf.get('foo')); // undefined
It seems really broken
@indexzero, ping
Will look into this soon.
It is broken. None of the set
examples in the readme work.
@slawo a PR to the README would be welcomed with praise and admiration.
The problem is due to no store has been defined when you call .set()
.
You must define it before, for instance: nconf.use('memory')
.
@indexzero could you consider using in-memory store by default avoiding the explicit store configuration?
This will be the default behavior in 1.0.0