Merge pull request #763 from buster-so/staging

Update PostgreSQL adapter SSL configuration to allow self-signed cert…
This commit is contained in:
dal 2025-08-25 00:34:48 -06:00 committed by GitHub
commit d6e2c70bcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -43,7 +43,7 @@ describe('PostgreSQLAdapter', () => {
database: 'testdb',
user: 'testuser',
password: 'testpass',
ssl: true,
ssl: { rejectUnauthorized: false },
});
expect(mockClient.connect).toHaveBeenCalled();
});
@ -130,7 +130,7 @@ describe('PostgreSQLAdapter', () => {
expect(Client).toHaveBeenCalledWith(
expect.objectContaining({
ssl: true,
ssl: { rejectUnauthorized: false },
})
);
});

View File

@ -51,9 +51,10 @@ export class PostgreSQLAdapter extends BaseAdapter {
// Handle SSL configuration - default to true for security
// But allow self-signed certificates to avoid connection errors
if (pgCredentials.ssl !== false) {
config.ssl = pgCredentials.ssl === true || pgCredentials.ssl === undefined
? { rejectUnauthorized: false } // Allow self-signed certificates
: pgCredentials.ssl; // Use custom SSL config if provided
config.ssl =
pgCredentials.ssl === true || pgCredentials.ssl === undefined
? { rejectUnauthorized: false } // Allow self-signed certificates
: pgCredentials.ssl; // Use custom SSL config if provided
}
// Handle connection timeout