removed static creds

This commit is contained in:
Joshua Perry 2024-06-08 20:12:23 +01:00
parent 74182f8ae1
commit a43dabfa85
1 changed files with 3 additions and 1 deletions

View File

@ -5,7 +5,9 @@ use mongodb::{
Client, Collection, Database,
};
pub async fn get_db_client() -> Result<Client> {
Ok(Client::with_uri_str("mongodb://root:example@localhost:27017").await?)
let username = std::env::var("DB_USERNAME")?;
let password = std::env::var("DB_PASSWORD")?;
Ok(Client::with_uri_str(format!("mongodb://{username}:{password}@localhost:27017")).await?)
}
pub async fn get_database() -> Result<Database> {