From 2db5a5a98136ee37fcfa197515f69b45ccf003a4 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 2 Feb 2017 16:11:36 +0100 Subject: [PATCH] Make node read the right .env file --- streaming/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/streaming/index.js b/streaming/index.js index 6652d08437..fd57c4e56e 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -4,7 +4,11 @@ import redis from 'redis' import pg from 'pg' import log from 'npmlog' -dotenv.config() +const env = process.env.NODE_ENV || 'development' + +dotenv.config({ + path: env === 'production' ? '.env.production' : '.env' +}) const pgConfigs = { development: { @@ -24,7 +28,6 @@ const pgConfigs = { } const app = express() -const env = process.env.NODE_ENV || 'development' const pgPool = new pg.Pool(pgConfigs[env]) const authenticationMiddleware = (req, res, next) => {