Browse Source

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

Fix #10223
pull/4/head
Eugen Rochko 5 years ago
committed by GitHub
parent
commit
13a7f05030
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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) => {
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)));

Loading…
Cancel
Save