From e313745f7c8d90b4dc6d3c350faef8e08af2ecd3 Mon Sep 17 00:00:00 2001 From: BlockListed <44610569+BlockListed@users.noreply.github.com> Date: Sat, 9 Sep 2023 11:10:04 +0200 Subject: [PATCH] make domain protocol validation work with multi-domains --- src/config.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index 0b737a5b..70878f06 100644 --- a/src/config.rs +++ b/src/config.rs @@ -733,11 +733,13 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> { } } - let dom = cfg.domain.to_lowercase(); - if !dom.starts_with("http://") && !dom.starts_with("https://") { - err!( - "DOMAIN variable needs to contain the protocol (http, https). Use 'http[s]://bw.example.com' instead of 'bw.example.com'" - ); + let domains = cfg.domain_change_back.split(',').map(|d| d.to_string().to_lowercase()); + for dom in domains { + if !dom.starts_with("http://") && !dom.starts_with("https://") { + err!( + "DOMAIN variable needs to contain the protocol (http, https). Use 'http[s]://bw.example.com' instead of 'bw.example.com'" + ); + } } let whitelist = &cfg.signups_domains_whitelist; @@ -1314,6 +1316,8 @@ impl Config { }).get(host).map(|h| h.clone()) } + // Yes this is a base_url + // But the configuration precedent says, that we call this a domain. pub fn main_domain(&self) -> String { self.domain_change_back().split(',').nth(0).expect("Missing domain").to_string() }