I am trying to set an environment variable from terminal to use it in my node.js code. Using config
package, I created config
folder in the root dir. Inside this folder I created two files:
default.json
{
"database": {
"mongo_url": "mongodb://localhost:27017/",
"db_name": "my_database",
"user_collection": "users",
"cats_collection": "cats"
},
"server": {
"port": "3300"
},
"jwtSecret": ""
}
custom-environment-variables.json
{
"jwtSecret": "myApp_jwtSecret"
}
Then I set myApp_jwtSecret
from terminal like this
setx myApp_jwtSecret bacd
I double checked it's value using
$myApp_jwtSecret
Why does config.get("jwtSecret")
still ""