From: Eugen Rochko Date: Thu, 2 Feb 2017 15:11:36 +0000 (+0100) Subject: Make node read the right .env file X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=61ce15d94b7e83fee902290e9466413be218ff87;p=mastodon.git Make node read the right .env file --- 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) => {