Passing environment variables to node.js using pm2

試著忘記壹切 提交于 2019-12-23 02:52:16

问题


I am trying to pass some arguments to my Express application which is run by pm2. There wasn't any hint in their documentation to do so, but apparently it's possible to pass some EV to your node application like SOME_STUFF=xxx pm2 start app.js.


回答1:


It's actually possible and I'm pretty sure it was in PM2's documentation some time ago.

Anyways, that's what you need to do:

pm2 start app.js -- -some_stuff xxx

Basically, add -- and then you can add your own app parameters.

Managed to find the source, it was hidden quite well: http://pm2.keymetrics.io/docs/usage/quick-start/#42-ways-of-starting-processes



来源:https://stackoverflow.com/questions/33656947/passing-environment-variables-to-node-js-using-pm2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!