Browse Source

Fix streaming API always attempting to use SSL with Postgres (#10231)

Fix #10223
Eugen Rochko 4 months ago
parent
commit
13a7f05030
No account linked to committer's email address
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      streaming/index.js

+ 6
- 3
streaming/index.js View File

@@ -89,7 +89,6 @@ const startWorker = (workerId) => {
89 89
       host:     process.env.DB_HOST || pg.defaults.host,
90 90
       port:     process.env.DB_PORT || pg.defaults.port,
91 91
       max:      10,
92
-      ssl:      !!process.env.DB_SSLMODE && process.env.DB_SSLMODE !== 'disable' ? true : undefined,
93 92
     },
94 93
 
95 94
     production: {
@@ -99,11 +98,15 @@ const startWorker = (workerId) => {
99 98
       host:     process.env.DB_HOST || 'localhost',
100 99
       port:     process.env.DB_PORT || 5432,
101 100
       max:      10,
102
-      ssl:      !!process.env.DB_SSLMODE && process.env.DB_SSLMODE !== 'disable' ? true : undefined,
103 101
     },
104 102
   };
105 103
 
106
-  const app    = express();
104
+  if (!!process.env.DB_SSLMODE && process.env.DB_SSLMODE !== 'disable') {
105
+    pgConfigs.development.ssl = true;
106
+    pgConfigs.production.ssl  = true;
107
+  }
108
+
109
+  const app = express();
107 110
   app.set('trusted proxy', process.env.TRUSTED_PROXY_IP || 'loopback,uniquelocal');
108 111
 
109 112
   const pgPool = new pg.Pool(Object.assign(pgConfigs[env], dbUrlToConfig(process.env.DATABASE_URL)));

Loading…
Cancel
Save