Adding icarus_envy #39
@@ -75,7 +75,7 @@ mod tests {
|
||||
|
||||
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(icarus_envy::keys::DBURL).expect("DATABASE_URL must be present");
|
||||
let tm_db_url = icarus_envy::environment::get_db_url().await;
|
||||
let tm_options = sqlx::postgres::PgConnectOptions::from_str(&tm_db_url).unwrap();
|
||||
sqlx::PgPool::connect_with(tm_options).await
|
||||
}
|
||||
@@ -87,7 +87,7 @@ mod tests {
|
||||
}
|
||||
|
||||
pub async fn connect_to_db(db_name: &str) -> Result<sqlx::PgPool, sqlx::Error> {
|
||||
let db_url = std::env::var(icarus_envy::keys::DBURL).expect("DATABASE_URL must be set for tests");
|
||||
let db_url = icarus_envy::environment::get_db_url().await;
|
||||
let options = sqlx::postgres::PgConnectOptions::from_str(&db_url)?.database(db_name);
|
||||
sqlx::PgPool::connect_with(options).await
|
||||
}
|
||||
|
Reference in New Issue
Block a user