Reputation: 325
Say I host ten different meteor apps on one server and mongoDB. The applications have same-named collections, so I want to use separate databases for each one of them.
How would I achieve this ? Exporting MONGO_URL will work for one app only, right?
Upvotes: 0
Views: 156
Reputation: 5108
I assume you have some sort of script to start each meteor application, for instance:
#!/bin.bash
cd /path/to/my/app
meteor
Then, you can just export the MONGO_URL variable as part of each meteor application's startup script, and each application will run with its own value for the MONGO_URL variable.
With that in mind, the startup script for app1 becomes:
#!/bin.bash
cd /path/to/my/app1
export MONGO_URL=mongodb://localhost:27017/app1
meteor
and the startup script for app2 is:
#!/bin.bash
cd /path/to/my/app2
export MONGO_URL=mongodb://localhost:27017/app2
meteor
Side-note: what I said applies even if you don't have startup scripts. If you start your applications by hand in the terminal, you can just do:
> cd /path/to/my/app1
> export MONGO_URL=mongodb://localhost:27017/app1
> meteor &
> ...
> cd /path/to/my/app2
> export MONGO_URL=mongodb://localhost:27017/app2
> meteor &
Upvotes: 1