use serde::Deserialize; use std::path::Path; #[derive(Debug, Deserialize, Clone)] pub struct ServerOptions { pub stun_server: String, } #[derive(Debug, Deserialize, Clone)] pub struct Config { pub server: ServerOptions, } impl Config { pub fn from_file>(p: P) -> Result> { let s = std::fs::read_to_string(p)?; let cfg: Config = serde_json::from_str(&s)?; Ok(cfg) } pub fn load_default() -> Result> { Self::from_file("appsettings.json") } } // WASM runtime loader: fetch `appsettings.json` from the hosting origin #[cfg(target_arch = "wasm32")] pub async fn load_config_from_server() -> Result> { // First try HTML-injection fast-path: look for a