# Database connection and pool configuration
#
# Used by both:
#   - build-config (UnifiedSiteConfig.database) — pool sizing for build-time DB checks
#   - rustelo_server (Config.database) — runtime connection pool
#
# The URL is resolved at runtime via DATABASE_URL env var (set in .env).
# Never hardcode credentials here.

let site_c = import "site/contracts.ncl" in

{
  database = {
    url               = "${DATABASE_URL}",
    create_if_missing = true,
    max_connections   = 10,
    min_connections   = 1,
    connect_timeout   = 30,
    idle_timeout      = 600,
    max_lifetime      = 1800,
  } | site_c.DatabaseConfig,
}
