feat(server): configurable DB pool size via --db-max-connections/DB_MAX_CONNECTIONS (#2)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 21:46:41 +02:00
parent 7e235ffd3e
commit 7181437625
4 changed files with 16 additions and 6 deletions
+3 -2
View File
@@ -15,7 +15,7 @@ use tokio::net::TcpListener;
/// Connect dependencies from `config` and serve until shutdown.
pub async fn run(config: Config) -> anyhow::Result<()> {
let db = Db::connect(&config.database_url)
let db = Db::connect(&config.database_url, config.db_max_connections)
.await
.context("connecting to the database")?;
@@ -136,7 +136,8 @@ pub async fn create_user(database_url: &str, email: &str, role: Role) -> anyhow:
auth::hash_password(&password).map_err(|err| anyhow::anyhow!("hashing password: {err}"))?
};
let db = Db::connect(database_url)
// CLI one-shot: a tiny pool is plenty.
let db = Db::connect(database_url, 2)
.await
.context("connecting to the database")?;