Set DIOXUS_PUBLIC_PATH to configured value
This commit is contained in:
@@ -22,6 +22,14 @@ pub fn main() -> Result<std::convert::Infallible> {
|
|||||||
.map_err(|e| Error::message_here(e.to_string()))
|
.map_err(|e| Error::message_here(e.to_string()))
|
||||||
.err_context("Failed to load config")?;
|
.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`
|
// `Ok(...?)` is because `dioxus::serve` expects an `anyhow::Result`
|
||||||
dioxus::serve(move || {
|
dioxus::serve(move || {
|
||||||
let config = config.clone();
|
let config = config.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user