You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example you can open multiple files. When you run save(), how do I specify where it goes?
nconf.file('path/to/your/config.json');
// add multiple files, hierarchically. notice the unique key for each file
nconf.file('user', 'path/to/your/user.json');
nconf.file('global', 'path/to/your/global.json');
nconf.set('foo','bar');
nconf.save(); // Where is 'foo' saved?
The text was updated successfully, but these errors were encountered:
So I've been looking into this as well. At the moment, with your example, foo would be saved to the 'global' file.
I've been looking at the tests, (specifically for the file store) and I think I've figured out how to control where things are saved. I'm testing this out right now, and will probably submit a PR for documentation when this is done, but the gist of this is that instead of using nconf.file() for both of your files, you can do this:
nconf.file('path/to/your/config.json')constuserStore=newnconf.File('path/to/your/user.json')userStore.load()// I think this loads/merges onto the memory storeconstglobalStore=newnconf.File('path/to/your/global.json')globalStore.load()// i think this loads/merges onto the memory storenconf.set('foo','bar')// now we save to the path/to/your/user.jsonuserStore.save((err)=>console.error('problem saving to path/to/your/user.json'))
In the example you can open multiple files. When you run save(), how do I specify where it goes?
The text was updated successfully, but these errors were encountered: