Browse Source

remove unused domain_origin config

pull/3870/head
BlockListed 2 months ago
parent
commit
949ac597fc
  1. 25
      src/config.rs

25
src/config.rs

@ -431,9 +431,6 @@ make_config! {
domain: String, true, def, "http://localhost".to_string();
/// Domain Set |> Indicates if the domain is set by the admin. Otherwise the default will be used.
domain_set: bool, false, def, false;
/// Comma seperated list of domain origins |> Domain URL origin (in https://example.com:8443/path, https://example.com:8443 is the origin)
/// If specified manually, one entry needs to exist for every url in domain.
domain_origin: String, false, auto, |c| extract_origins(&c.domain);
/// Domain path |> Domain URL path (in https://example.com:8443/path, /path is the path)
/// MUST be the same for all domains.
domain_path: String, false, auto, |c| extract_url_path(c.domain.split(',').next().expect("Missing domain"));
@ -743,10 +740,6 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> {
}
}
if cfg.domain.split(',').count() != cfg.domain_origin.split(',').count() {
err!("Each DOMAIN_ORIGIN entry corresponds to exactly one entry in DOMAIN.");
}
let whitelist = &cfg.signups_domains_whitelist;
if !whitelist.is_empty() && whitelist.split(',').any(|d| d.trim().is_empty()) {
err!("`SIGNUPS_DOMAINS_WHITELIST` contains empty tokens");
@ -1018,24 +1011,6 @@ pub fn extract_url_origin(url: &str) -> String {
}
}
// urls should be comma-seperated
fn extract_origins(urls: &str) -> String {
let mut origins = urls
.split(',')
.map(extract_url_origin)
// TODO add itertools as dependency maybe
.fold(String::new(), |mut acc, origin| {
acc.push_str(&origin);
acc.push(',');
acc
});
// Pop trailing comma
origins.pop();
origins
}
/// Extracts the path from a URL.
/// All trailing '/' chars are trimmed, even if the path is a lone '/'.
fn extract_url_path(url: &str) -> String {

Loading…
Cancel
Save