auth-login / src /db.rs
amy-invitation
main
b7fdfb4
Raw History Blame Contribute Delete
379 Bytes
use sqlx::PgPool;
use std::time::Duration;
pub async fn db() -> Result<PgPool, sqlx::Error> {
let database_url = std::env::var("DATABASE_URL").expect("Database url not found!");
let pool = sqlx::postgres::PgPoolOptions::new()
.max_connections(15)
.acquire_timeout(Duration::from_secs(10))
.connect(&database_url)
.await?;
Ok(pool)
}