nconf icon indicating copy to clipboard operation
nconf copied to clipboard

'overrides' doesn't override values if it's not first in hierarchy

Open shedar opened this issue 10 years ago • 10 comments

Looks like overrides method is just another store, not a high priority store as expected from the name. Test https://github.com/flatiron/nconf/blob/master/test/provider-test.js#L120 passes due to provider order. but it will fail if you'll change it as following:

"when multiple stores are used": {
          topic: new nconf.Provider()
            .add('file1', {type: 'file', file: files[0]})
            .add('file2', {type: 'file', file: files[1]})
            .overrides({foo: {bar: 'baz'}}), //moved overrides lower
          "should respect the hierarchy": function(provider) {
            var merged = provider.load();

            helpers.assertMerged(null, merged);
            assert.equal(merged.foo.bar, 'baz');
            assert.equal(merged.candy.something, 'file1');
          }

Store priorities will also fix #70

shedar avatar Dec 17 '14 10:12 shedar

+1

joeferraro avatar Feb 05 '15 00:02 joeferraro

+1

mikkotikkanen avatar Jun 05 '15 19:06 mikkotikkanen

+1

same for "defaults"

Fantus avatar Jul 15 '15 15:07 Fantus

+1

fobos avatar Oct 31 '15 18:10 fobos

+1

edabe avatar Feb 10 '16 06:02 edabe

+1

tommhuth avatar May 27 '16 15:05 tommhuth

+1

palecio-xumak avatar Dec 05 '16 23:12 palecio-xumak

+1

senseysensor avatar Oct 18 '17 06:10 senseysensor

+1

microsoftly avatar Nov 10 '21 23:11 microsoftly

+1

drondov avatar Dec 07 '21 22:12 drondov