node.js - Splitting production/development databases -
i'm working on mongodb backed expressjs app. i've used express generator create it.
i work on development database through mongolab, , deploy heroku (which backed mongolab database).
what best practices splitting these 2 when start app in development mode uses development mongo instance, , when deploy heroku in production mode use production db?
thanks!
heroku's 12factor architecture document great job of explaining both best practices of config management, , rationale behind them:
the tldr is, "pull in config environment variables , use explicit configuration instead of named environments 'development' or 'production.'"
heroku provide environment variables need connecting mongolab db, have sort out providing same variables app locally. 1 common solution .env
file:
this file don't check in, provides list of key-value pairs local environment variables. can run through heroku local or, more generally, via tools node-foreman or docker-compose.
disclosure: i'm node.js platform owner @ heroku
Comments
Post a Comment