diff --git a/backend/src/monitor.rs b/backend/src/monitor.rs index 668cf3ebbf..26006f9cde 100644 --- a/backend/src/monitor.rs +++ b/backend/src/monitor.rs @@ -505,22 +505,25 @@ pub async fn reload_base_url_setting(db: &DB) -> error::Result<()> { .fetch_optional(db) .await?; + let std_base_url = std::env::var("BASE_URL") + .ok() + .unwrap_or_else(|| "http://localhost".to_string()); let base_url = if let Some(q) = q_base_url { if let Ok(v) = serde_json::from_value::(q.value.clone()) { - v + if v != "" { + v + } else { + std_base_url + } } else { tracing::error!( "Could not parse base_url setting as a string, found: {:#?}", &q.value ); - std::env::var("BASE_URL") - .ok() - .unwrap_or_else(|| "http://localhost".to_string()) + std_base_url } } else { - std::env::var("BASE_URL") - .ok() - .unwrap_or_else(|| "http://localhost".to_string()) + std_base_url }; let q_oauth = sqlx::query!(