Skip to content

Instantly share code, notes, and snippets.

@davidjrice
Created February 22, 2010 03:52
Show Gist options
  • Select an option

  • Save davidjrice/310766 to your computer and use it in GitHub Desktop.

Select an option

Save davidjrice/310766 to your computer and use it in GitHub Desktop.
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