문제

I am using Ubuntu 13.10 lokal and running my meteorJs app on it. My MongoDB is an external DB (modulus.io).

I set my mongoDb in my console like this:

sudo MONGO_URL='mongodb://login@db' meteor

Works fine.

But everytime when I restart my lokal meteorJs App this settings seems to be resetet! So everytime when I restart my App I have to set the enviroment variable again and again ...

Is there a way to set this variable permanent in my meteorJs App so I dont have to re set it again and again.

도움이 되었습니까?

해결책

Fast solution:

Create startup.sh and insert:

export MONGO_URL='mongodb://login@db'

meteor

sh startup.sh

다른 팁

Another way to set environment variables that are accessed from within your app, is to put the following in your server code, i.e. for HTTP_FORWARDED_COUNT:

process.env.HTTP_FORWARDED_COUNT = 1

Doing it programmatically like this does not work for variables that need to be read during the app startup process, however - such as the MongoDB URL.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top