Created
July 22, 2018 15:06
-
-
Save sagar-gavhane/0e65c087949bcbb5bb24ffe9a3951723 to your computer and use it in GitHub Desktop.
environment-dependent-node-js-configuration
This file contains 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
// var config = require('./config.js').get(process.env.NODE_ENV); | |
var config = { | |
production: { | |
session: { | |
key: 'the.express.session.id', | |
secret: 'something.super.secret' | |
}, | |
database: 'mongodb://<user>:<pwd>@apollo.modulusmongo.net:27017/db', | |
twitter: { | |
consumerKey: 'consumer Key', | |
consumerSecret: 'consumer Secret', | |
callbackURL: 'http://yoururl.com/auth/twitter/callback' | |
} | |
}, | |
default: { | |
session: { | |
key: 'the.express.session.id', | |
secret: 'something.super.secret' | |
}, | |
database: 'mongodb://127.0.0.1:27017/db', | |
twitter: { | |
consumerKey: 'consumer Key', | |
consumerSecret: 'consumer Secret', | |
callbackURL: 'http://127.0.0.1:3000/auth/twitter/callback' | |
} | |
} | |
} | |
exports.get = function get(env) { | |
return config[env] || config.default; | |
} | |
// Ref: https://medium.com/node-and-beyond/environment-dependent-node-js-configuration-b51149286e7e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment