开发者

node/express: set NODE_ENV when using Forever to run script continuously

开发者 https://www.devze.com 2023-04-11 08:57 出处:网络
How can I set the NODE_ENV variable/parameter to \"production\" when I\'m using forever to start开发者_StackOverflow中文版 my node script

How can I set the NODE_ENV variable/parameter to "production" when I'm using forever to start开发者_StackOverflow中文版 my node script

I got this so far:

forever start -l forever.log -o out.log -e err.log -a app.js


You can set NODE_ENV as normal and then run forever:

NODE_ENV=production forever [flags] start app.js [app_flags]

The initial NODE_ENV will be preserved when the server restarts - behaviour that was fixed in this issue:

https://github.com/nodejitsu/forever/issues/116

Older versions of forever can use the following command line format:

NODE_ENV=production forever [flags] app.js
0

精彩评论

暂无评论...
验证码 换一张
取 消