Created
January 13, 2017 09:25
-
-
Save SpencerAung/1ea6b17e77f0000565d2405f80dbb920 to your computer and use it in GitHub Desktop.
Configure node environment
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
/* | |
* From The complete nodejs developer course 2 https://www.udemy.com/the-complete-nodejs-developer-course-2/learn/v4/overview | |
*/ | |
var env = process.env.NODE_ENV || "development"; | |
if(env==="development" || env==="test") { | |
var config = require('./config.json'); | |
var envConfig = config[env]; | |
Object.keys(envConfig).forEach((key) => { | |
process.env[key] = envConfig[key]; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment