Skip to content

Commit

Permalink
Make undefined check safe
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Aug 16, 2017
1 parent f8d4cef commit 0f5167e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -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 })
}

Expand Down

0 comments on commit 0f5167e

Please sign in to comment.