0

When I'm developing on my local box I use mongodb://localhost/Data as my connection string when connecting to mongoDB that's running locally.

But then when I upload/update my local app to nodejitsu I have to change the url to the one provided by nodejitsu mongodb://nodejitsu_XXX:xyxyxyxy.mongolab.com:29950/nodejitsu_XXX_nodejitsudb12121212

How do I switch between my localhost mongoDB connection URL and the one provided by Nodejitsu? I don't wanna keep changing it and committing the changes everytime I want to test out my local changes in the cloud...

laggingreflex
  • 32,948
  • 35
  • 141
  • 196
  • 1
    Typical best practice is to define an environment variable to signify that you are in a development environment and load the appropriate parts such as your development database URL and other things in your configuration. So if you separate these and your production variables then this becomes quite easy. – Neil Lunn Apr 26 '14 at 10:42

1 Answers1

0

I use nconf https://github.com/flatiron/nconf , you can easily change between diferent configurations

B3n0n
  • 1