Merge pull request #49 from SKBotNL/master

Make PostgreSQL maxActiveConnections configurable
This commit was merged in pull request #49.
This commit is contained in:
NotAlexNoyle authored and GitHub committed 2026-09-17 17:42:52 -04:00
commit 0f2c29acde
4 files changed
+7 -1

No files matched your search

@@ -7,6 +7,7 @@ interface Config {
val postgresDatabase: String
val postgresUser: String
val postgresPassword: String?
val postgresMaxActiveConnections: Int
val redisHost: String
val redisPort: Int
val redisDatabase: Int
@@ -12,6 +12,7 @@ private constructor(
override val postgresDatabase: String,
override val postgresUser: String,
override val postgresPassword: String?,
override val postgresMaxActiveConnections: Int,
override val redisHost: String,
override val redisPort: Int,
override val redisDatabase: Int,
@@ -30,6 +31,7 @@ private constructor(
val postgresDatabase = yamlConfig.parseKeyAs<String>("postgresDatabase")
val postgresUser = yamlConfig.parseKeyAs<String>("postgresUser")
val postgresPassword = yamlConfig.parseKeyAs<String?>("postgresPassword")
val postgresMaxActiveConnections = yamlConfig.parseKeyAs<Int>("postgresMaxActiveConnections")
val redisHost = yamlConfig.parseKeyAs<String>("redisHost")
val redisPort = yamlConfig.parseKeyAs<Int>("redisPort")
@@ -42,6 +44,7 @@ private constructor(
postgresPort == null ||
postgresDatabase == null ||
postgresUser == null ||
postgresMaxActiveConnections == null ||
redisHost == null ||
redisPort == null ||
redisDatabase == null
@@ -56,6 +59,7 @@ private constructor(
postgresDatabase,
postgresUser,
postgresPassword,
postgresMaxActiveConnections,
redisHost,
redisPort,
redisDatabase,
@@ -42,12 +42,12 @@ internal class PostgreSQL private constructor() {
postgreSQL.pool =
PostgreSQLConnectionBuilder.createConnectionPool {
maxActiveConnections = 6
host = config.postgresHost
port = config.postgresPort
database = config.postgresDatabase
username = config.postgresUser
password = config.postgresPassword
maxActiveConnections = config.postgresMaxActiveConnections
}
return postgreSQL
} catch (e: Exception) {
+1
View File
@@ -8,6 +8,7 @@ postgresPort: 5432
postgresDatabase: diamond
postgresUser: ^{DIAMONDBANKOG_POSTGRES_USER}
postgresPassword: ^{DIAMONDBANKOG_POSTGRES_PASSWORD}
postgresMaxActiveConnections: 10
# ---Redis(-compatible) key value store---
redisHost: 127.0.0.1