你如何设置环境变量来永远运行meteorjs?如果我进行导出并永远运行,就像这样
export PORT=80 MONGO_URL=mongodb://localhost:3002/appname
sudo forever -f start bundle/main.js
Run Code Online (Sandbox Code Playgroud)
永远不会运行带节点的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
Run Code Online (Sandbox Code Playgroud)
如果我直接运行它,它会顺利运行:
sudo PORT=80 MONGO_URL=mongodb://localhost:3002/appname ROOT_URL=http://myapp.com node bundle/main.js
Run Code Online (Sandbox Code Playgroud)
如果我这样做就像这个答案一样有效.但为什么它不适用于出口声明?有没有办法永远告诉配置文件来读取这些设置?我没有在永远的文档中看到一种方式.