use sqlx::{PgPool, postgres::PgPoolOptions}; use std::env; const DATABASE_URL_FALLBACK: &str = "postgres://health:health@127.0.0.1:5432/health"; pub async fn connect() -> Result { let database_url = env::var("DATABASE_URL").unwrap_or_else(|_| { tracing::warn!("DATABASE_URL not set, falling back to the default local database"); DATABASE_URL_FALLBACK.to_string() }); PgPoolOptions::new() .max_connections(5) .connect(&database_url) .await }