如何设置环境variables来永久运行meteorjs

你如何设置环境variables来永远运行meteorjs? 如果我做出口并永远运行,像这样

export PORT=80 MONGO_URL=mongodb://localhost:3002/appname sudo forever -f start bundle/main.js 

永远不会运行与节点meteorjs捆绑:

 /Users/../bundle/server/server.js:166 throw new Error("MONGO_URL must be set in environment"); ^ Error: MONGO_URL must be set in environment at run (/Users/../bundle/server/server.js:166:11) at Object.<anonymous> (/Users/../bundle/server/server.js:331:1) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/Users/../bundle/main.js:1:63) at Module._compile (module.js:456:26) error: Forever detected script exited with code: 8 

如果我直接运行,它运行平稳:

 sudo PORT=80 MONGO_URL=mongodb://localhost:3002/appname ROOT_URL=http://myapp.com node bundle/main.js 

如果我这样做,就像这个答案一样。 但是,为什么它不适用于出口声明? 有没有办法永远告诉一个configuration文件来阅读这些设置? 我没有看到永远的文件的方式 。

你可以像节点一样永远运行。 尝试以下

 sudo PORT=80 MONGO_URL=mongodb://localhost:3002/appname ROOT_URL=http://myapp.com forever -f start bundle/main.js