Last active
August 29, 2015 14:05
-
-
Save RB-Lab/f9c807963fb2106ace71 to your computer and use it in GitHub Desktop.
index.js for node configs
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 fs = require('fs'); | |
var path = require('path'); | |
var env = process.env.NODE_ENV || 'development'; | |
var config = JSON.parse(fs.readFileSync(__dirname + '/'+env+'.json')); | |
config.env = env; | |
config.root = path.dirname(require.main.filename); | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You just create a directory
/config
, add there this file and then you can add there configurations for different environment, such asdevelopment.json
. Usage is pretty simple: