节点/表达式:使用Forever连续运行脚本时设置NODE_ENV [英] node/express: set NODE_ENV when using Forever to run script continuously

查看:118
本文介绍了节点/表达式:使用Forever连续运行脚本时设置NODE_ENV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我将 NODE_ENV 变量/参数设置为生产"时使用永远启动我的节点脚本

How can I set the NODE_ENV variable/parameter to "production" when I'm using forever to start my node script

到目前为止,我已经知道了:

I got this so far:

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

推荐答案

您可以将NODE_ENV设置为正常状态,然后永久运行:

You can set NODE_ENV as normal and then run forever:

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

服务器重新启动时,将保留初始NODE_ENV-此问题中已解决的行为:

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

这篇关于节点/表达式:使用Forever连续运行脚本时设置NODE_ENV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆