diff --git a/src/main/java/fr/maif/automate/MainVerticle.kt b/src/main/java/fr/maif/automate/MainVerticle.kt index fc2f3d4..17e0f48 100644 --- a/src/main/java/fr/maif/automate/MainVerticle.kt +++ b/src/main/java/fr/maif/automate/MainVerticle.kt @@ -135,6 +135,8 @@ class MainVerticle : AbstractVerticle() { Some("port" to pgConfig.port), Some("database" to pgConfig.database), Some("url" to url), + Some("initial_pool_size" to 1), + Some("max_pool_size" to pgConfig.maxPoolSize), pgConfig.username.map { "username" to it }, pgConfig.password.map { "password" to it } ).flatMap { it.toList() } diff --git a/src/main/java/fr/maif/automate/commons/Configuration.kt b/src/main/java/fr/maif/automate/commons/Configuration.kt index e582e9c..59e3887 100644 --- a/src/main/java/fr/maif/automate/commons/Configuration.kt +++ b/src/main/java/fr/maif/automate/commons/Configuration.kt @@ -104,7 +104,7 @@ data class LetSEncryptConfig(val server: String, val accountId: String) { } } -data class PostgresConfig(val host: String, val port: Int, val database: String, val username: Option, val password: Option) { +data class PostgresConfig(val host: String, val port: Int, val database: String, val username: Option, val password: Option, val maxPoolSize: Int) { companion object { fun load(config: Config): PostgresConfig = PostgresConfig( @@ -112,7 +112,8 @@ data class PostgresConfig(val host: String, val port: Int, val database: String, port = config.getInt("postgres.port"), database = config.getString("postgres.database"), username = Option(config.getString("postgres.username")), - password = Option(config.getString("postgres.password")) + password = Option(config.getString("postgres.password")), + maxPoolSize = config.getInt("postgres.maxPoolSize") ) } } diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index dc1aed8..96b644d 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -52,6 +52,8 @@ postgres { username = ${?POSTGRESQL_ADDON_USER} password = "password" password = ${?POSTGRESQL_ADDON_PASSWORD} + maxPoolSize = 3 + maxPoolSize = ${?POSTGRESQL_ADDON_MAX_POOL_SIZE} } clevercloud {