From a43dabfa850d4d346bc8d57bf9e8dce922006ef0 Mon Sep 17 00:00:00 2001 From: r0r-5chach Date: Sat, 8 Jun 2024 20:12:23 +0100 Subject: [PATCH] removed static creds --- src/account/db.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/account/db.rs b/src/account/db.rs index 26f7fbc..617d3bd 100644 --- a/src/account/db.rs +++ b/src/account/db.rs @@ -5,7 +5,9 @@ use mongodb::{ Client, Collection, Database, }; pub async fn get_db_client() -> Result { - 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 {