Read environment variables in Node.js

前端 未结 6 2111
不知归路
不知归路 2020-11-22 11:41

Is there a way to read environment variables in Node.js code?

Like for example Python\'s os.environ[\'HOME\'].

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 12:09

    process.env.ENV_VARIABLE
    

    Where ENV_VARIABLE is the name of the variable you wish to access.

    See Node.js docs for process.env.

提交回复
热议问题