小编ram*_*eer的帖子

reload process.env variables without reboot

Can we reload environment variables (process.env) with the updated values without restarting the nodejs app or server ?

In other words, I have created a new environment variable (NEW_VARIABLE) and have set a value in my Windows 7 machine. Now I have written a function to read the environment variable as below in my NodeJS application.

setInterval(() => {
    console.log(process.env.NEW_VARIABLE);
}, 5000);
Run Code Online (Sandbox Code Playgroud)

environment-variables node.js

5
推荐指数
1
解决办法
3862
查看次数

标签 统计

environment-variables ×1

node.js ×1