Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
207 views
in Technique[技术] by (71.8m points)

javascript - MongoDB / Meteor / Export MONGO_URL to deployed applications

I tried to export a settings.json as documented in the meteor.js documentation in order to connect my Meteor.js app with an external MongoHQ database :

{
    "env": {
        "MONGO_URL" : "mongodb://xxx:[email protected]:10037/xxx"
    }
}

with the command :

mrt deploy myapp.meteor.com --settings settings.json

It doesn't even work, My app continue to connect the local database provided with the Meteor.app ! My MONGO_URL env variable didnt changed.

Is there any solution to export my MONGO_URL env variable to connect an external MongoDB database ?

I saw that is possible to change it while using heroku or modulus, what about the standard deploying meteor.com solution ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You are not able to use your own MONGO_URL with Meteor deploy hosting.

Meteor deploy hosting takes care of the Email with Mailgun (if you use it), and provides mongodb for all apps deployed there.

It is possible to change the MAIL_URL, but it is not possible to use a different mongodb.

You can try, though im not sure it will work:

Place this in your server side code somewhere

process.env.MONGO_URL = '..';

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...