I tried to google this problems, but still not find the solution. I think we still need more documentation and example about this.
this is my settings.json
and this is how i run it:
meteor --settings ./settings.json
but the meteor still connect to default mongodb
where I wrong and how to solve this?
February 2, 2020, 5:33am
I remember once I had a similar problem but I then had to set the value of the process_env variable I change to the one from the settings. It was not for the database though. Could you try something like that ?
`process.env.MONGO_URL = Meteor.settings.MONGO_URL;
Also another solution would be to pass the MONGO_URL when launching the app. Instead of just “meteor” do:
You can also create a script in package.json for it:
"dev": "MONGO_URL=mongodb://127.0.0.1:27017/test meteor"
Hope it helps
February 2, 2020, 8:37am
The Manual says that MONGO URL is set by environnement variable not by settings
@yozawiratama, did you manage to solve this? I am currently battling through this and for the life of me, I cannot stop my app connecting to the localhost:3001 MongoDB instance.
Actually, I just got this to work. Apparently, when running your app on localhost, you have to set the MONGO_URL env variable through the console when you fire up your app →
MONGO_URL=mongodb://localhost:27017/databasename meteor run
Posting for everyone’s reference.
Hello, sorry I just solve this with
and on server/main.js
add this on meteor startup
process.env.MAIL_URL = Meteor.settings.MAIL_URL;
and set on packages.json
"start": "meteor run --settings settings.json"
and last just run
you can check the usage in this repository. It’s the same as your solution
you can also use different settings.json on production.
@yozawiratama, thanks for posting.
I assume in the main.js file, it should be:
process.env.MONGO_URL = Meteor.settings.MONGO_URL;
I use this command to start meteor with a non-normal db - and it works for me
MONGO_URL=mongodb://127.0.0.1:27018/DATABASENAME meteor --settings settingsLOC.json
settingsLOC.json contains no mongoURL settings.
DATABASENAME to be replaced with your db name, obviously
(I use this to read back a dump from production db’s)