Created
May 20, 2014 15:51
-
-
Save asakusuma/d6e988208ac68f45f543 to your computer and use it in GitHub Desktop.
broccoli-env index
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
var _ = require('lodash') | |
exports.getEnv = function (key) { | |
if (_.isString(key) && key !== 'ENV') { | |
return process.env['BROCCOLI_' + key] || ''; | |
} else { | |
var env = process.env.BROCCOLI_ENV || 'development' | |
if (env !== 'production' && env !== 'development') { | |
throw new Error('Environment set to "' + env + '", but only BROCCOLI_ENV=production and BROCCOLI_ENV=development are supported at the moment') | |
} | |
return env | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment