mirror of https://github.com/buster-so/buster.git
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:
parent
da7af5f384
commit
f469b2a152
|
@ -43,7 +43,7 @@ describe('PostgreSQLAdapter', () => {
|
||||||
database: 'testdb',
|
database: 'testdb',
|
||||||
user: 'testuser',
|
user: 'testuser',
|
||||||
password: 'testpass',
|
password: 'testpass',
|
||||||
ssl: true,
|
ssl: { rejectUnauthorized: false },
|
||||||
});
|
});
|
||||||
expect(mockClient.connect).toHaveBeenCalled();
|
expect(mockClient.connect).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
@ -130,7 +130,7 @@ describe('PostgreSQLAdapter', () => {
|
||||||
|
|
||||||
expect(Client).toHaveBeenCalledWith(
|
expect(Client).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
ssl: true,
|
ssl: { rejectUnauthorized: false },
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -51,9 +51,10 @@ export class PostgreSQLAdapter extends BaseAdapter {
|
||||||
// Handle SSL configuration - default to true for security
|
// Handle SSL configuration - default to true for security
|
||||||
// But allow self-signed certificates to avoid connection errors
|
// But allow self-signed certificates to avoid connection errors
|
||||||
if (pgCredentials.ssl !== false) {
|
if (pgCredentials.ssl !== false) {
|
||||||
config.ssl = pgCredentials.ssl === true || pgCredentials.ssl === undefined
|
config.ssl =
|
||||||
? { rejectUnauthorized: false } // Allow self-signed certificates
|
pgCredentials.ssl === true || pgCredentials.ssl === undefined
|
||||||
: pgCredentials.ssl; // Use custom SSL config if provided
|
? { rejectUnauthorized: false } // Allow self-signed certificates
|
||||||
|
: pgCredentials.ssl; // Use custom SSL config if provided
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle connection timeout
|
// Handle connection timeout
|
||||||
|
|
Loading…
Reference in New Issue