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
I have a config file such as { "database": { "host": "localhost", "port": "13306", "user": "root" } }
I am calling this in my code:
var nconf = require('nconf');
nconf.argv().env().file({
file: 'db/config.json'
});
console.log(nconf.get("database:host"));
My assumption was that I would be able to override the value in the config file using an environment variable such as database:host=somethingElse npm test. However either I cannot figure out how to encode the colon or it is not possible to have a colon in an environment key.
How does one override these properties.
The text was updated successfully, but these errors were encountered:
I think I have figured it out by setting the logicalSeparator in the env() call to '_' and then setting database_host. Is this documented anywhere outside of the code? If not, I would gladly write some.
I was a little surprised to be bit by using nconf in two files and one overwriting the other.
I have a config file such as
{ "database": { "host": "localhost", "port": "13306", "user": "root" } }
I am calling this in my code:
My assumption was that I would be able to override the value in the config file using an environment variable such as
database:host=somethingElse npm test
. However either I cannot figure out how to encode the colon or it is not possible to have a colon in an environment key.How does one override these properties.
The text was updated successfully, but these errors were encountered: