PM2 + 流星环境设置 [英] PM2 + Meteor Environment Setup

查看:64
本文介绍了PM2 + 流星环境设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置 Meteor 以使用 pm2 (https://github.com/Unitech/pm2) 而不是永远作为节点进程监视器.我没有获得 pm2 进程需要看到 Meteor 应用程序的环境变量.

I am trying to setup Meteor to use pm2 (https://github.com/Unitech/pm2) instead of forever as the node process monitor. I have had no luck in getting the environment variables that a Meteor application needs to be seen by the pm2 process.

这是我的过程:

export MONGO_URL="mongodb://localhost:27017/meteor"
export PORT=4000
export ROOT_URL="https://beta.example.com/"
pm2 start main.js --name MyMeteorApp

在来自 pm2 的错误日志中,我看到我的 Meteor 应用程序抱怨它找不到 MONGO_URL.

In the error log from pm2 I see that my Meteor application is complaining that it cannot find MONGO_URL.

是否有特定的方法可以让我使用 pm2 进行导出?

Is there a specific way that I need to do the exports in order to work with pm2?

推荐答案

经过一番挖掘,我找到了正确的答案.在 pm2 中,您放置在 JSON 任务定义中但不是保留关键字之一的任何内容都将作为环境变量导出到您在 pm2 中运行的进程.

After doing some digging I found the right answer. In pm2 anything that you place inside the JSON task definition that isn't one of the reserved keywords is exported to the process that you are running inside of pm2 as an environment variable.

这篇关于PM2 + 流星环境设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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