about summary refs log tree commit diff
path: root/streaming
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-03-10 16:48:44 +0100
committerThibaut Girka <thib@sitedethib.com>2019-03-10 16:48:44 +0100
commitdfe7322922e869ae72edb9b8980b905876db9ed0 (patch)
treebf279e7af52036451cf1c1fdc68b7b5748b5921d /streaming
parent42cc93e8923a1b6cdb61574e9a86e360cba56abb (diff)
parentc11dff50493ecb106390153866bea539f3587293 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'streaming')
-rw-r--r--streaming/index.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 2e3439886..869186934 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -24,7 +24,7 @@ const dbUrlToConfig = (dbUrl) => {
     return {};
   }
 
-  const params = url.parse(dbUrl);
+  const params = url.parse(dbUrl, true);
   const config = {};
 
   if (params.auth) {
@@ -45,8 +45,8 @@ const dbUrlToConfig = (dbUrl) => {
 
   const ssl = params.query && params.query.ssl;
 
-  if (ssl) {
-    config.ssl = ssl === 'true' || ssl === '1';
+  if (ssl && ssl === 'true' || ssl === '1') {
+    config.ssl = true;
   }
 
   return config;
@@ -89,9 +89,7 @@ const startWorker = (workerId) => {
       host:     process.env.DB_HOST || pg.defaults.host,
       port:     process.env.DB_PORT || pg.defaults.port,
       max:      10,
-      ssl: {
-        sslmode: process.env.DB_SSLMODE || 'prefer',
-      },
+      ssl:      !!process.env.DB_SSLMODE && process.env.DB_SSLMODE !== 'disable' ? true : undefined,
     },
 
     production: {
@@ -101,9 +99,7 @@ const startWorker = (workerId) => {
       host:     process.env.DB_HOST || 'localhost',
       port:     process.env.DB_PORT || 5432,
       max:      10,
-      ssl: {
-        sslmode: process.env.DB_SSLMODE || 'prefer',
-      },
+      ssl:      !!process.env.DB_SSLMODE && process.env.DB_SSLMODE !== 'disable' ? true : undefined,
     },
   };