Created
February 22, 2010 03:52
-
-
Save davidjrice/310766 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node bin/server.js // loads development env | |
| NODE_ENV=production node bin/server.js //loads production env! | |
| // config/default.js | |
| exports.development = { | |
| port: 8012, | |
| couchDb: { | |
| db: 'comments', | |
| host: 'localhost', | |
| port: 5984, | |
| } | |
| }; | |
| exports.production = { | |
| port: 80, | |
| couchDb: { | |
| db: 'comments', | |
| host: 'localhost', | |
| port: 5984, | |
| } | |
| }; | |
| // bin/server.js | |
| var environment = "development" | |
| if(process.env["NODE_ENV"]){ | |
| environment = process.env["NODE_ENV"] | |
| } | |
| var | |
| config = require('config/default'), | |
| db = | |
| require('dep/node-couchdb') | |
| .createClient(config[environment].couchDb.port, config[environment].couchDb.host) | |
| .db(config[environment].couchDb.db); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment