+ 1
Regarding NodeJS environment variable
I have assigned some data to one environment variable and the name of the environment variable is on local variable. Example: My Environment Variable: USERX = bibek Local variable containing name of environment variable: hasNameOfEnvVar = "USERX" Now I need to access the value stored in environment variable (USERX) that is (bibek) using the local variable (hasNameOfEnvVar) How can I do that? process.env.hasNameOfEnvVar didn't work, My program works exactly like this I don't have any other alternatives to do the job. So, I need suggestions as soon as possible.
3 Answers
0
You should use one library like "dotenv" to manage the environment variable
0
Jairo Soto yes I am using dotenv and global variable are on .env files.
Please tell if you have the solution to the question.
0
Import dotenv like this,
require('dotenv').config()