Update PostgreSQL adapter SSL configuration to allow self-signed certificates

- Modified the SSL configuration in both the PostgreSQL adapter and its tests to use { rejectUnauthorized: false } instead of a boolean true value.
- Ensured consistency in handling SSL settings across the adapter and its tests.
This commit is contained in:
dal 2025-08-25 00:26:29 -06:00
parent da7af5f384
commit f469b2a152
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
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,7 +51,8 @@ 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
config.ssl =
pgCredentials.ssl === true || pgCredentials.ssl === undefined
? { rejectUnauthorized: false } // Allow self-signed certificates
: pgCredentials.ssl; // Use custom SSL config if provided
}