1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-24 17:51:14 +02:00

chore: remove DB access checker

This commit is contained in:
Nuno Góis 2025-09-09 13:59:53 +01:00
parent 71b0d424b8
commit 42f6bdc1bc
No known key found for this signature in database
GPG Key ID: 71ECC689F1091765
2 changed files with 0 additions and 39 deletions

View File

@ -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(() => {});
}
};

View File

@ -186,7 +186,6 @@ import { UPDATE_REVISION } from './features/feature-toggle/configuration-revisio
import type { IFeatureUsageInfo } from './services/version-service.js'; import type { IFeatureUsageInfo } from './services/version-service.js';
import { defineImpactMetrics } from './features/metrics/impact/define-impact-metrics.js'; import { defineImpactMetrics } from './features/metrics/impact/define-impact-metrics.js';
import type { IClientInstance } from './types/stores/client-instance-store.js'; import type { IClientInstance } from './types/stores/client-instance-store.js';
import { dbAccessChecker } from './db/db-access-checker.js';
export async function initialServiceSetup( export async function initialServiceSetup(
{ authentication }: Pick<IUnleashConfig, 'authentication'>, { authentication }: Pick<IUnleashConfig, 'authentication'>,
@ -337,10 +336,6 @@ async function start(
const config = createConfig(opts); const config = createConfig(opts);
const logger = config.getLogger('server-impl.js'); const logger = config.getLogger('server-impl.js');
if (config.db.awsIamAuth) {
await dbAccessChecker(config.db, logger);
}
try { try {
if (config.db.disableMigration) { if (config.db.disableMigration) {
logger.info('DB migration: disabled'); logger.info('DB migration: disabled');