From 2b016c34f765fc36d622dcb4a3e26351ad9f167e Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sun, 24 Apr 2022 14:01:46 +0100 Subject: [PATCH] fix: use MONGODB env variable for rauth --- src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6bd62ec1..c8115626 100644 --- a/src/main.rs +++ b/src/main.rs @@ -105,9 +105,13 @@ async fn main() { let db = DatabaseInfo::Auto.connect().await.unwrap(); db.migrate_database().await.unwrap(); - let mongo_db = mongodb::Client::with_uri_str("mongodb://localhost") - .await - .expect("Failed to init db connection."); + // This is entirely temporary code until rauth is migrated to quark. + // (and / or otherwise gets updated to MongoDB v2 driver) + let mongo_db = mongodb::Client::with_uri_str( + &std::env::var("MONGODB").unwrap_or_else(|_| "mongodb://localhost".to_string()), + ) + .await + .expect("Failed to init db connection."); rauth::entities::sync_models(&mongo_db.database("revolt")).await;