nconf icon indicating copy to clipboard operation
nconf copied to clipboard

merging object from 2 sources

Open jmls opened this issue 9 years ago • 2 comments

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 ?

jmls avatar Jan 07 '16 13:01 jmls

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

mansona avatar Feb 26 '17 08:02 mansona

can confirm that in 2019 this does not indeed work

askdesigners avatar Oct 07 '19 16:10 askdesigners