Fixed issue

This commit is contained in:
2025-04-27 13:04:04 -04:00
parent 62c57c7262
commit fcbd077e51
2 changed files with 2 additions and 1 deletions

View File

@@ -34,8 +34,8 @@ pub mod db {
}
async fn get_db_url() -> String {
#[cfg(debug_assertions)] // Example: Only load .env in debug builds
dotenvy::dotenv().ok();
// dotenvy::from_filename(".env").ok();
env::var(keys::DBURL).expect(keys::error::ERROR)
}

View File

@@ -74,6 +74,7 @@ mod tests {
pub const LIMIT: usize = 6;
pub async fn get_pool() -> Result<sqlx::PgPool, sqlx::Error> {
dotenvy::dotenv().ok(); // Load .env file if it exists
let tm_db_url = std::env::var(keys::DBURL).expect("DATABASE_URL must be present");
let tm_options = sqlx::postgres::PgConnectOptions::from_str(&tm_db_url).unwrap();
sqlx::PgPool::connect_with(tm_options).await