问题
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