-
-
Save camshaft/5118648 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
DB_URL=mongo://... |
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
/** | |
* Module deps | |
*/ | |
var config = require("config"); | |
// Get the DB | |
var DB_URL = config("DB_URL", "You need to set DB_URL for the mongo instance"); | |
// Throws an exception | |
var REDIS_URL = config("REDIS_URL", "You need to set REDIS_URL for the redis instance"); |
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
/** | |
* Get the config | |
*/ | |
var defaults = {}; | |
exports = module.exports = function(name, message) { | |
if(process.env[name]) return process.env[name]; | |
if(defaults[name]) return defaults[name]; | |
throw new Error(message); | |
} | |
exports.default = function(key, value) { | |
defaults[key] = value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment