I am also trying to get this to work. I have a web based app, that i want to work differently from my mobile app.
Locally, I am able to connect to a remote db (on meteor.com) via these commands (lots of helpful posts for this):
$ meteor mongo --url http://blah.meteor.com/
mongodb://client-ca3bxae5:b05dx2ae-1da1-a82b-45b7-bc35b4b11ed9@production-db-a2.meteor.io:27017/blah_meteor_com
then copy the output mongodb url to my path as:
$ MONGO_URL='mongodb://client-ca3bxae5:b05dx2ae-1da1-a82b-45b7-bc35b4b11ed9@production-db-a2.meteor.io:27017/blah_meteor_com' meteor run --port 8000
Works great.
My problem is, how do I generate a mobile app (android or ios), with the mongo_url?
I tried adding this to my project (folder: /lib file:config.js)
Meteor.startup(function () {
process.env.MONGO_URL = 'mongodb://user:password@roduction-db-a2.meteor.io:27017/blah_meteor_com';
});
I then start the app like this:
$ meteor --port 8000
But no dice. I also send the env vars to the console to review. (folder: server)
Meteor.startup(function () {
console.log(process.env);
});
Result:
I20150409-10:04:57.118(-5)? { TERM_PROGRAM: 'Apple_Terminal',
...
I20150409-10:04:57.120(-5)? MONGO_URL: 'mongodb://user:password@production-db-a2.meteor.io:27017/blah_meteor_com',
...
I20150409-10:04:57.121(-5)? ROOT_URL: 'http://localhost:8000/',
I20150409-10:04:57.121(-5)? MOBILE_DDP_URL: 'http://localhost:8000',
I20150409-10:04:57.121(-5)? MOBILE_ROOT_URL: 'http://localhost:8000',
I20150409-10:04:57.121(-5)? NODE_ENV: 'development',
I20150409-10:04:57.121(-5)? HTTP_FORWARDED_COUNT: '1',
I20150409-10:04:57.122(-5)? METEOR_SHELL_DIR: '/Users/ME/Desktop/Meteor/demo/.meteor/local/shell',
I20150409-10:04:57.122(-5)? METEOR_PARENT_PID: '84523',
I20150409-10:04:57.122(-5)? METEOR_PRINT_ON_LISTEN: 'true',
I20150409-10:04:57.122(-5)? NODE_PATH: '' }
I have reviewed many links and sites for this, but i just can’t connect to a remote mongodb, w/o using env variables.
Any thoughts?