在localhost上设置环境变量是使用 export 完成的。
Setting an environment variable on the localhost is done using export.
export PORT = 80
我的问题是如何为远程
My Question is how to set an environment var for the remote meteor server. I am using Meteor's free hosting service and deploy using meteor deploy appname, and therefore have no ssh access to the remote command line.
我想将 DISABLE_WEBSOCKETS 设置为true。 我看过可能的流星命令的列表,并没有找到与设置env vars有关的列表。
I'd like to set DISABLE_WEBSOCKETS to true. I've looked at the list of possible meteor commands and haven't found one which relates to setting env vars.
推荐答案您在运行服务器时以相同的方式执行,例如,您不必使用 export ,您可以将环境变量放在您使用的行中启动流星。
You do it the same way when you run your server e.g, you don't have to use export you can just put the environment variables in the line you use to start meteor.
PORT=80 node main.js或如果您永远使用
PORT=80 forever start main.js甚至与流星
DISABLE_WEBSOCKETS=TRUE meteor我对你的设置感到困惑,远程流星服务器意味着一个生产环境?您不应该在生产中使用 meteor 命令,因为它没有以这种方式进行优化,性能将受到非常大的影响。
I'm a bit confused about your setup, by remote meteor server you mean a production environment? You shouldn't use the meteor command in production as it is not optimized this way and performance would be very significantly affected.
Meteor使用进程获取环境变量,所以无论您用来启动该过程,您都可以使用典型的终端/ bash / shell / ssh将环境变量传递给它你曾经开始过程。
Meteor gets the environment variables using process so whatever you use to start the process you can pass the environment variables to it using the typical terminal/bash/shell/ssh that you used to start the process up.
更多推荐
如何在Meteor的远程服务器上设置环境变量
发布评论