mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
chore: new approach
This commit is contained in:
parent
e5c8216faf
commit
3d52c40b46
@ -6,7 +6,7 @@ import type { IUnleashConfig } from './lib/types/option.js';
|
|||||||
import { secondsToMilliseconds } from 'date-fns';
|
import { secondsToMilliseconds } from 'date-fns';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { getDBPasswordResolver } from './lib/db/aws-iam.js';
|
import { getDBPassword } from './lib/db/aws-iam.js';
|
||||||
|
|
||||||
log.setLogLevel('error');
|
log.setLogLevel('error');
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
@ -23,10 +23,11 @@ export async function migrateDb(
|
|||||||
{ db }: Pick<IUnleashConfig, 'db'>,
|
{ db }: Pick<IUnleashConfig, 'db'>,
|
||||||
stopAt?: string,
|
stopAt?: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
const password = await getDBPassword(db);
|
||||||
return noDatabaseUrl(async () => {
|
return noDatabaseUrl(async () => {
|
||||||
const custom = {
|
const custom = {
|
||||||
...db,
|
...db,
|
||||||
password: getDBPasswordResolver(db),
|
password,
|
||||||
connectionTimeoutMillis: secondsToMilliseconds(10),
|
connectionTimeoutMillis: secondsToMilliseconds(10),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,10 +46,11 @@ export async function migrateDb(
|
|||||||
export async function requiresMigration({
|
export async function requiresMigration({
|
||||||
db,
|
db,
|
||||||
}: Pick<IUnleashConfig, 'db'>): Promise<boolean> {
|
}: Pick<IUnleashConfig, 'db'>): Promise<boolean> {
|
||||||
|
const password = await getDBPassword(db);
|
||||||
return noDatabaseUrl(async () => {
|
return noDatabaseUrl(async () => {
|
||||||
const custom = {
|
const custom = {
|
||||||
...db,
|
...db,
|
||||||
password: getDBPasswordResolver(db),
|
password,
|
||||||
connectionTimeoutMillis: secondsToMilliseconds(10),
|
connectionTimeoutMillis: secondsToMilliseconds(10),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,10 +69,11 @@ export async function requiresMigration({
|
|||||||
|
|
||||||
// This exists to ease testing
|
// This exists to ease testing
|
||||||
export async function resetDb({ db }: IUnleashConfig): Promise<void> {
|
export async function resetDb({ db }: IUnleashConfig): Promise<void> {
|
||||||
|
const password = await getDBPassword(db);
|
||||||
return noDatabaseUrl(async () => {
|
return noDatabaseUrl(async () => {
|
||||||
const custom = {
|
const custom = {
|
||||||
...db,
|
...db,
|
||||||
password: getDBPasswordResolver(db),
|
password,
|
||||||
connectionTimeoutMillis: secondsToMilliseconds(10),
|
connectionTimeoutMillis: secondsToMilliseconds(10),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user