Spaces:
Runtime error
Runtime error
Download src/db.rs from arami21/auth-login: direct link, hf CLI and curl.
- Browser
- Download file 379 Bytes
-
https://huggingface.co/spaces/arami21/auth-login/resolve/main/src/db.rs
- Command line
-
hf download hf://spaces/arami21/auth-login/src/db.rs
-
curl -L -o db.rs https://huggingface.co/spaces/arami21/auth-login/resolve/main/src/db.rs
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) | |
| } | |