Skip to content

Commit

Permalink
fix: make ssl optional
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Nov 3, 2023
1 parent 4bfb422 commit d819952
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion integrations/integration-postgres/makePostgresClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export const makePostgresClient = zFunction(
({databaseUrl, migrationsPath, migrationTableName, ...opts}) => {
const getPool = memoize(
async () => {
const useSsl =
databaseUrl.includes('sslmode=') &&
!databaseUrl.includes('sslmode=disable')
const pool = await createPool(databaseUrl, {
interceptors: createInterceptors({
logQueries: true, // TODO: Use roarr-cli to make things better
Expand All @@ -35,7 +38,7 @@ export const makePostgresClient = zFunction(
transformFieldNames: opts.transformFieldNames ?? true,
benchmarkQueries: false,
}),
ssl: {rejectUnauthorized: false},
ssl: useSsl ? {rejectUnauthorized: false} : undefined,
statementTimeout: 'DISABLE_TIMEOUT', // Not supported by pgBouncer
idleInTransactionSessionTimeout: 'DISABLE_TIMEOUT', // Not supported by pgBouncer
maximumPoolSize: 10,
Expand Down

0 comments on commit d819952

Please sign in to comment.