I am running config@1.30.0
and I am attempting to get settings from the environment variables using .\config\custom-environment-variables.json
does not work. However, it reads from the .\config\default.json
just fine.
.\config\custom-environment-variables.json
{
"key": "app_key"
}
.\config\default.json
{
"key": "defaultKey"
}
running
const config = require('config');
console.log(config.get('key'))
always prints
defaultKey
but prints nothing when I set the key
property in config/default to an empty string. How can I resolve this?
What I have tried
- Opened a new console anytime I set the environment variable using set app_key=newKey
- Set the environment manually