From 42f6bdc1bc667c9e3c2f55895cbf28e51555dc05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Tue, 9 Sep 2025 13:59:53 +0100 Subject: [PATCH] chore: remove DB access checker --- src/lib/db/db-access-checker.ts | 34 --------------------------------- src/lib/server-impl.ts | 5 ----- 2 files changed, 39 deletions(-) delete mode 100644 src/lib/db/db-access-checker.ts diff --git a/src/lib/db/db-access-checker.ts b/src/lib/db/db-access-checker.ts deleted file mode 100644 index 760e5c9960..0000000000 --- a/src/lib/db/db-access-checker.ts +++ /dev/null @@ -1,34 +0,0 @@ -import postgresPkg from 'pg'; -const { Client } = postgresPkg; -import type { IDBOption, Logger } from '../server-impl.js'; -import { getDBPassword } from './aws-iam.js'; - -export const dbAccessChecker = async (db: IDBOption, logger: Logger) => { - if (!db.awsIamAuth) return; - - logger.info( - 'Using AWS IAM authentication for database connection. Checking DB access...', - ); - - const password = await getDBPassword(db); - - const client = new Client({ - host: db.host, - port: db.port, - user: db.user, - database: db.database, - password, - statement_timeout: 10_000, - connectionTimeoutMillis: 10_000, - }); - try { - await client.connect(); - await client.query('SELECT 1'); - logger.info('DB auth/connection successful'); - } catch (e: any) { - const code = e?.code ?? 'unknown'; - throw new Error(`DB auth/connection failed (pg code: ${code})`); - } finally { - await client.end().catch(() => {}); - } -}; diff --git a/src/lib/server-impl.ts b/src/lib/server-impl.ts index 54b4809086..78c6d261bc 100644 --- a/src/lib/server-impl.ts +++ b/src/lib/server-impl.ts @@ -186,7 +186,6 @@ import { UPDATE_REVISION } from './features/feature-toggle/configuration-revisio import type { IFeatureUsageInfo } from './services/version-service.js'; import { defineImpactMetrics } from './features/metrics/impact/define-impact-metrics.js'; import type { IClientInstance } from './types/stores/client-instance-store.js'; -import { dbAccessChecker } from './db/db-access-checker.js'; export async function initialServiceSetup( { authentication }: Pick, @@ -337,10 +336,6 @@ async function start( const config = createConfig(opts); const logger = config.getLogger('server-impl.js'); - if (config.db.awsIamAuth) { - await dbAccessChecker(config.db, logger); - } - try { if (config.db.disableMigration) { logger.info('DB migration: disabled');