nconf
nconf copied to clipboard
merging object from 2 sources
let's say that my nconf is configured so :
nconf.argv()
.env('_')
.file({ file: path.resolve(path.join(__dirname,'./config.json')) });
and I have this in the json file
{ "tokens": { "abc": "foo" } }
within my app, I also do
config.set('tokens:def',"bar")
I thought that I could then say
config.get("tokens")
and get a merged object. But I don't :(
I need to be able to merge these options as I work in several environments and each one has a different config in the .json file
Is there a way of doing this ?
I'm getting the impression that this should work 🤔 it seems similar to the semantics of how it works with files and overrides. I would suggest writing a test similar to this to show this failing case: https://github.com/indexzero/nconf/pull/255
can confirm that in 2019 this does not indeed work