diff --git a/index.js b/index.js index ecda7b3a2..77cad2a92 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,19 @@ require('babel-core/register') require('coffee-script/register') - +const _ = require('underscore') const env = require('node-env-file') -if (process.env.NODE_ENV === 'test') { +const NODE_ENV = process.env.NODE_ENV + +if (NODE_ENV === 'test') { env('./.env.test') -} else if (process.env.NODE_ENV === undefined || process.env.NODE_ENV === 'development') { - // If NODE_ENV is unset, assume that it's a local setup + + // If NODE_ENV is development or unset, assume that it's a local setup +} else if (NODE_ENV === 'development' || _.isUndefined(NODE_ENV)) { env('./.env') -} else { + // Other envs: staging, production +} else { env('./.env', { raise: false }) }