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
The documentation seems to state that parameters from calls to .argv()/.env()/.file() take precedence based on the order they are called (with the first taking precedence
I find that if I have multiple .file() calls, the later .file() calls take precedence, when documentation indicates the first should. The below code gives a final value of 2, though I'd expect 1 (from the first file) to be the actual value.
var fs = require("fs");
var path = require("path");
var first = path.resolve("./first.json");
var second = path.resolve("./second.json");
fs.writeFileSync(first, JSON.stringify({"abc" : 1, "def": 1}, null, 4));
fs.writeFileSync(second, JSON.stringify({"abc" : 2, "def": 1}));
var nconf = require("nconf");
nconf.file({ file : first})
nconf.file({ file : second});
console.log("value is:", nconf.get("abc"));
The text was updated successfully, but these errors were encountered:
fschwiet
changed the title
precedence of .file() calls note as expected
precedence of .file() calls not as expected
Aug 7, 2014
Oh, it looks like multiple calls to .file() don't merge values from the files (if the last file doesn't have a value, values from previous files are ignored). So perhaps only the last file is being used...
The documentation seems to state that parameters from calls to .argv()/.env()/.file() take precedence based on the order they are called (with the first taking precedence
I find that if I have multiple .file() calls, the later .file() calls take precedence, when documentation indicates the first should. The below code gives a final value of 2, though I'd expect 1 (from the first file) to be the actual value.
The text was updated successfully, but these errors were encountered: