From 3d52c40b46c5bb0ad4cb2b6048a970a361c431c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Thu, 4 Sep 2025 16:06:27 +0100 Subject: [PATCH] chore: new approach --- src/migrator.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/migrator.ts b/src/migrator.ts index 1a591eb119..37fdb88756 100644 --- a/src/migrator.ts +++ b/src/migrator.ts @@ -6,7 +6,7 @@ import type { IUnleashConfig } from './lib/types/option.js'; import { secondsToMilliseconds } from 'date-fns'; import path from 'path'; import { fileURLToPath } from 'node:url'; -import { getDBPasswordResolver } from './lib/db/aws-iam.js'; +import { getDBPassword } from './lib/db/aws-iam.js'; log.setLogLevel('error'); const __filename = fileURLToPath(import.meta.url); @@ -23,10 +23,11 @@ export async function migrateDb( { db }: Pick, stopAt?: string, ): Promise { + const password = await getDBPassword(db); return noDatabaseUrl(async () => { const custom = { ...db, - password: getDBPasswordResolver(db), + password, connectionTimeoutMillis: secondsToMilliseconds(10), }; @@ -45,10 +46,11 @@ export async function migrateDb( export async function requiresMigration({ db, }: Pick): Promise { + const password = await getDBPassword(db); return noDatabaseUrl(async () => { const custom = { ...db, - password: getDBPasswordResolver(db), + password, connectionTimeoutMillis: secondsToMilliseconds(10), }; @@ -67,10 +69,11 @@ export async function requiresMigration({ // This exists to ease testing export async function resetDb({ db }: IUnleashConfig): Promise { + const password = await getDBPassword(db); return noDatabaseUrl(async () => { const custom = { ...db, - password: getDBPasswordResolver(db), + password, connectionTimeoutMillis: secondsToMilliseconds(10), };