INNER CODE UNIT · Rust
is_reserved_domain
ovexro/dockpanel · panel/backend/src/routes/mod.rs:130
pub fn is_reserved_domain(domain: &str) -> bool {
static RESERVED: std::sync::OnceLock<(Option<String>, Vec<String>)> = std::sync::OnceLock::new();
let (panel_host, zones) = RESERVED.get_or_init(|| {
let panel_host = panel_host_from_base_url(&std::env::var("BASE_URL").unwrap_or_default());
let zones = std::env::var("RESERVED_DOMAINS")
.unwrap_or_default()
.split(',')
.map(|s| s.trim().to_lowercase())
.filter(|s| !s.is_empty())
.collect();
(panel_host, zones)
});
reserved_match(domain, panel_host.as_deref(), zones)
}
/// Extract the bare host from `BASE_URL` as setup.sh writes it
/// (`https://panel.example.com`, or empty on a domainless install). Only the