node.js node/express: 使用 Forever 连续运行脚本时设置 NODE_ENV
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7674565/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
node/express: set NODE_ENV when using Forever to run script continuously
提问by pkyeck
回答by cjohn
You can set NODE_ENV as normal and then run forever:
您可以将 NODE_ENV 设置为正常,然后永远运行:
NODE_ENV=production forever [flags] start app.js [app_flags]
The initial NODE_ENVwill be preserved when the server restarts - behaviour that was fixed in this issue:
NODE_ENV服务器重新启动时将保留初始值- 此问题中已修复的行为:
https://github.com/nodejitsu/forever/issues/116
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

