about summary refs log tree commit diff
path: root/streaming
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-03-11 00:51:23 +0100
committerGitHub <noreply@github.com>2019-03-11 00:51:23 +0100
commit13a7f05030cdcbab24aeb25944a9a430238dbff1 (patch)
tree9bf084f47acd839e45a07ca3da4e0c681281e5c9 /streaming
parent5506b9406db7847ffd0892a0cda1c042b3157a6a (diff)
Fix streaming API always attempting to use SSL with Postgres (#10231)
Fix #10223
Diffstat (limited to 'streaming')
-rw-r--r--streaming/index.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 86a91d12b..2a51a1a0d 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -89,7 +89,6 @@ const startWorker = (workerId) => {
       host:     process.env.DB_HOST || pg.defaults.host,
       port:     process.env.DB_PORT || pg.defaults.port,
       max:      10,
-      ssl:      !!process.env.DB_SSLMODE && process.env.DB_SSLMODE !== 'disable' ? true : undefined,
     },
 
     production: {
@@ -99,11 +98,15 @@ const startWorker = (workerId) => {
       host:     process.env.DB_HOST || 'localhost',
       port:     process.env.DB_PORT || 5432,
       max:      10,
-      ssl:      !!process.env.DB_SSLMODE && process.env.DB_SSLMODE !== 'disable' ? true : undefined,
     },
   };
 
-  const app    = express();
+  if (!!process.env.DB_SSLMODE && process.env.DB_SSLMODE !== 'disable') {
+    pgConfigs.development.ssl = true;
+    pgConfigs.production.ssl  = true;
+  }
+
+  const app = express();
   app.set('trusted proxy', process.env.TRUSTED_PROXY_IP || 'loopback,uniquelocal');
 
   const pgPool = new pg.Pool(Object.assign(pgConfigs[env], dbUrlToConfig(process.env.DATABASE_URL)));