I'm using the node-config module for mongo connection strings and jwt keys.
For example:
if(!config.get('jwtPrivateKey')){
throw new Error('FATAL ERROR: jwtPrivateKey is not defined');
My custom-environment-variables.json
file looks like:
{
"jwtPrivateKey": "video-app_jwtPrivateKey",
"db": "video-app_db"
}
default.json
{
"db": "default db",
"jwtPrivateKey": "default key"
}
production.json
{
"db": "production db",
"jwtPrivateKey": "production key"
}
long story short - although the environment variables are set in heroku, node-config doesn't look at the values set in custom-environment-variables.json
. I can alter the NODE_ENV and get the relevant json file's hardcoded values, but the environment variables are never used, which seems to contradict the docs