use log::info;
use sqlx::postgres::{PgPool, PgPoolOptions};
use std::env;
pub async fn create_db_client() -> PgPool {
let connection_string = env::var("DB_CONNECTION_STRING").expect("DB_CONNECTION_STRING not set");
info!("connecting to DB");
let pool = PgPoolOptions::new()
.max_connections(5)
.connect(&connection_string)
.await
.expect("failed to connect to db");
info!("DB connected");
pool
}