如何在Meteor的远程服务器上设置环境变量

编程入门 行业动态 更新时间:2024-10-19 05:21:23
本文介绍了如何在Meteor的远程服务器上设置环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在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的远程服务器上设置环境变量

本文发布于:2023-11-01 01:43:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547881.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:环境变量   器上   如何在   Meteor

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!