Last active
December 23, 2015 22:25
-
-
Save desmondmorris/8accf4a5920b6ba4d759 to your computer and use it in GitHub Desktop.
An environment aware config module for node.js
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
/** | |
* An environment aware configuration module. | |
* | |
* @module config/config | |
*/ | |
'use strict'; | |
// Module dependencies | |
var extend = require('util')._extend; | |
var config = { | |
// All enviornments inherit from here. | |
"default": { | |
environment: process.env.NODE_ENV || "development", | |
port: process.env.PORT || 3000, | |
mongo: { | |
uri: process.env.MONGO_URI || "mongodb://127.0.0.1:27017" | |
}, | |
redis: { | |
uri: process.env.REDIS_URI || "redis://127.0.0.1:6379" | |
} | |
}, | |
"development": {}, | |
"test": {}, | |
"production": {} | |
}; | |
module.exports = extend( | |
config.default, | |
config[config.default.environemnt] || {} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment