Meteor App Environment Variables

假如想象 提交于 2019-12-25 02:12:13

问题


I'm using meteor and new to it. After some research, I stumbled upon this post. Exactly what I need as of the moment. I need to connect to an external mongodb somewhere in the server.

Now the question is where can I find the meteor config file (If ever if it's what I'm looking for) containing all environment variables (For example, MONGO_URL). If it's not any config file then how can I make this possible?


回答1:


This is done by setting the environment variable(s) directly on the command line or in a startup script. For a production use case, have a look at my answer to this question.

When you are developing your app, on your localhost you can also have a script wrapper around your call to meteor like:

#!/bin/bash
MONGO_URL="..." meteor
exit 0

or alternatively you can just add a line to your ~/.bashrc to export the MONGO_URL variable to all console sessions.

There is no fully documented list of environment variables for meteor that I'm aware of, but an answer to this question lists a number of them. For nearly all circumstances, however, you need only a few and they appear in the meteor docs or somewhere in the wiki.



来源:https://stackoverflow.com/questions/21518799/meteor-app-environment-variables

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!