chore(): Add support for extra pool configuration (#11636)
**What** Support more pool configuration
This commit is contained in:
committed by
GitHub
parent
d493347980
commit
ca6a15717d
@@ -27,7 +27,7 @@ export function createPgConnection(options: Options) {
|
||||
pool: {
|
||||
// https://knexjs.org/guide/#pool
|
||||
...(pool ?? {}),
|
||||
min: (pool?.min as number) ?? 2,
|
||||
min: (pool?.min as number) ?? 1,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ export function loadDatabaseConfig(
|
||||
const clientUrl =
|
||||
options?.database?.clientUrl ?? getEnv("DATABASE_URL", moduleName)
|
||||
|
||||
const poolEnvConfig = getEnv("DATABASE_POOL", moduleName)
|
||||
const database = {
|
||||
clientUrl,
|
||||
schema: getEnv("DATABASE_SCHEMA", moduleName) ?? "public",
|
||||
@@ -79,6 +80,7 @@ export function loadDatabaseConfig(
|
||||
getEnv("DATABASE_DRIVER_OPTIONS", moduleName) ||
|
||||
JSON.stringify(getDefaultDriverOptions(clientUrl))
|
||||
),
|
||||
pool: poolEnvConfig ? JSON.parse(poolEnvConfig) : undefined,
|
||||
debug: false,
|
||||
connection: undefined,
|
||||
}
|
||||
@@ -91,6 +93,7 @@ export function loadDatabaseConfig(
|
||||
database.driverOptions =
|
||||
options.database!.driverOptions ??
|
||||
getDefaultDriverOptions(database.clientUrl)
|
||||
database.pool = options.database!.pool ?? database.pool
|
||||
database.debug = options.database!.debug ?? database.debug
|
||||
database.connection = options.database!.connection
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user