pm2.json 代码如下
[{ "name" : "dingtalk-mobile", "script" : "app.js", "error_file" : "app-err.log", "out_file" : "app-out.log", "pid_file" : "app.pid", "instances": 2, "env": { "NODE_ENV": "dev" }, "env_pre": { "NODE_ENV": "pre" }, "env_production": { "NODE_ENV": "production" } }]
启动方式
pm2 start app.json --env pre
执行以上命令, 如下节点的变量将生效
"env_pre": { "NODE_ENV": "pre" }
process.env.NODE_ENV 值是 pre
2、pm2 start app.json --env production
时间: 2024-10-27 05:38:55