about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-02 16:11:36 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-02 16:11:36 +0100
commit61ce15d94b7e83fee902290e9466413be218ff87 (patch)
tree6fb09951ff69d68a3e62214f99095cf486430e4e
parentd1a01dbbddac1b134e7a2bc93d972de4a7c53f0f (diff)
Make node read the right .env file
-rw-r--r--streaming/index.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 6652d0843..fd57c4e56 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) => {