Skip to content

Instantly share code, notes, and snippets.

@asakusuma
Created May 20, 2014 15:51
Show Gist options
  • Save asakusuma/d6e988208ac68f45f543 to your computer and use it in GitHub Desktop.
Save asakusuma/d6e988208ac68f45f543 to your computer and use it in GitHub Desktop.
broccoli-env index
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