mirror of
https://github.com/flibusta-apps/services_manager_server.git
synced 2025-12-06 04:25:38 +01:00
Some checks failed
Build docker image / Build-Docker-Image (push) Has been cancelled
21 lines
471 B
Rust
21 lines
471 B
Rust
use crate::config::CONFIG;
|
|
|
|
use sqlx::{postgres::PgPoolOptions, PgPool};
|
|
|
|
pub async fn get_pg_pool() -> PgPool {
|
|
let database_url: String = format!(
|
|
"postgresql://{}:{}@{}:{}/{}",
|
|
CONFIG.postgres_user,
|
|
CONFIG.postgres_password,
|
|
CONFIG.postgres_host,
|
|
CONFIG.postgres_port,
|
|
CONFIG.postgres_db
|
|
);
|
|
|
|
PgPoolOptions::new()
|
|
.max_connections(1)
|
|
.connect(&database_url)
|
|
.await
|
|
.unwrap()
|
|
}
|