about summary refs log tree commit diff
path: root/streaming
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-03-10 20:43:54 +0100
committerGitHub <noreply@github.com>2019-03-10 20:43:54 +0100
commit3cef04610cd809c7bd01adc00d34fb3d25261a16 (patch)
treebf279e7af52036451cf1c1fdc68b7b5748b5921d /streaming
parent42cc93e8923a1b6cdb61574e9a86e360cba56abb (diff)
parentdfe7322922e869ae72edb9b8980b905876db9ed0 (diff)
Merge pull request #950 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
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,
     },
   };