I would like to use my own MongoHQ database to use when deploying a Meteor app using meteor deploy
. The documentation explains how to do this when deploying and running on a machine I control:
$ PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js
But the documentation seems a bit sparse on how to do this with meteor deploy
. Is it possible?
EDIT: I tried following http://docs.meteor.com/#meteor_settings and added a settings.json file and put in it:
{"MONGO_URL" : "mongodb://user:pass@mongohq.com:10000/mydatabase"}
then deployed with
meteor deploy myappname.meteor.com --settings settings.json
but the deployed version doesn't seen to be using my database
A quick scan of the codebase reveals this line in remote_collection_driver.js:
Meteor._RemoteCollectionDriver = new Meteor._RemoteCollectionDriver(process.env.MONGO_URL);
I'm sure if you hacked that to point where you wanted it, it would work. If that's too much of a kluge (for instance, if you plan on ever updating Meteor versions) you could experiment with trying to change Meteor._RemoteCollectionDriver or process.env.MONGO_URL early enough, from your own code (without hacking into Meteor's js directly). Good luck.
I ended up deploying to Heroku instead using the buildpack. Then I could set the variables using the heroku configs.