Config.get() Not Getting Configuration From File: "custom-environment-variables.json" Nodejs, JavaScript

Config.get() Not Getting Configuration From File: "custom-environment-variables.json" Nodejs, JavaScript

·

1 min read

Firstly you have a lot of syntactical errors for example in custom-environment-variables.json

{
    "mail":{
        "password":"app_password"
    }
}

Now if u need to store the password of your mail server in the environment variables

On windows

$env:app_password=12345

or

$env:vidly_jwtPrivateKey="mySecureKey"

On Linux and OSX:

export app_password=12345

how to run ? app.js

const config = require("config");
console.log("Mail Password: " + config.get("mail.password"));

Screenshot (41).png