From f41f4f8d8041b2779020d443070f9ca50265a7c2 Mon Sep 17 00:00:00 2001 From: Ethan Girouard Date: Tue, 30 Jun 2026 21:11:26 -0400 Subject: [PATCH] Set DIOXUS_PUBLIC_PATH to configured value --- src/server/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/server/main.rs b/src/server/main.rs index d68ce71..4a23283 100644 --- a/src/server/main.rs +++ b/src/server/main.rs @@ -22,6 +22,14 @@ pub fn main() -> Result { .map_err(|e| Error::message_here(e.to_string())) .err_context("Failed to load config")?; + // Dioxus doesn't expose a way to configure the public path other than this environment + // variable, and also doesn't provide a way to read what the public path is. As a workaround we + // expose a config option and set this variable that Dioxus expects. + // SAFETY: "This function is safe to call in a single-threaded program." + unsafe { + std::env::set_var("DIOXUS_PUBLIC_PATH", config.server.public_path.clone()); + } + // `Ok(...?)` is because `dioxus::serve` expects an `anyhow::Result` dioxus::serve(move || { let config = config.clone();