common: initial database handling

Can be configured from the config file, and also using environment
options.

```toml
[database]
url = "postgresql://fc_ci:password@localhost/fc_ci"
max_connections = 20
min_connections = 5
connect_timeout = 30
idle_timeout = 600
max_lifetime = 1800
```

We'll want to support SQlite in the future, and better secret handling
for database credentials. For now, this is workable.

---

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I36b4c1306511052a2748ca9d5d3429366a6a6964
This commit is contained in:
raf 2025-11-02 21:31:21 +03:00
commit 0e6d249e0f
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
6 changed files with 530 additions and 5 deletions

View file

@ -4,6 +4,7 @@ members = [
"crates/evaluator",
"crates/queue-runner",
"crates/common",
"crates/migrate-cli",
]
resolver = "3"
@ -17,15 +18,17 @@ authors = ["NotAShelf <raf@notashelf.dev"]
[workspace.dependencies]
tokio = { version = "1.48.0", features = ["full"] }
axum = "0.8.6"
sqlx = { version = "0.8.6", features = ["runtime-tokio-rustls", "postgres", "chrono", "uuid"] }
sqlx = { version = "0.8.6", features = ["runtime-tokio-rustls", "postgres", "chrono", "uuid", "migrate"] }
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.145"
uuid = { version = "1.18.1", features = ["v4", "serde"] }
chrono = { version = "0.4.42", features = ["serde"] }
tracing = "0.1.41"
tracing-subscriber = "0.3.20"
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
anyhow = "1.0.100"
thiserror = "2.0.17"
git2 = "0.20.2"
clap = { version = "4.5.51", features = ["derive"] }
config = "0.15.18"
tempfile = "3.8"
toml = "0.9.8"