diff options
author | Daniel García <[email protected]> | 2024-07-12 20:05:54 +0200 |
---|---|---|
committer | Daniel García <[email protected]> | 2024-07-12 20:05:54 +0200 |
commit | aaf61dc117d96df153163d390873bbdaec8ec27c (patch) | |
tree | c249f9e1c95e8115e1558044d887a042c773e487 /src/config.rs | |
parent | bbbbd2fb482684149b573aa1acbc98f7fb1408b9 (diff) | |
download | vaultwarden-aaf61dc117d96df153163d390873bbdaec8ec27c.tar.gz vaultwarden-aaf61dc117d96df153163d390873bbdaec8ec27c.zip |
Change config compat to use auto, rename blacklist
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/config.rs b/src/config.rs index 7ce2a255..40071abf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -148,9 +148,8 @@ macro_rules! make_config { // Copy the values from the deprecated flags to the new ones - if config.http_request_blacklist_regex.is_none() { - config.http_request_blacklist_non_global_ips = config.icon_blacklist_non_global_ips; - config.http_request_blacklist_regex = config.icon_blacklist_regex.clone(); + if config.http_request_block_regex.is_none() { + config.http_request_block_regex = config.icon_blacklist_regex.clone(); } config @@ -544,12 +543,12 @@ make_config! { /// [Deprecated] Icon blacklist non global IPs |> Use `http_request_blacklist_non_global_ips` instead icon_blacklist_non_global_ips: bool, false, def, true; - /// HTTP blacklist Regex |> Any domains or IPs that match this regex won't be fetched by the internal HTTP client. + /// Block HTTP domains/IPs by Regex |> Any domains or IPs that match this regex won't be fetched by the internal HTTP client. /// Useful to hide other servers in the local network. Check the WIKI for more details - http_request_blacklist_regex: String, true, option; - /// Blacklist non global IPs |> Enabling this will cause the internal HTTP client to refuse to connect to any non global IP address. + http_request_block_regex: String, true, option; + /// Block non global IPs |> Enabling this will cause the internal HTTP client to refuse to connect to any non global IP address. /// Useful to secure your internal environment: See https://en.wikipedia.org/wiki/Reserved_IP_addresses for a list of IPs which it will block - http_request_blacklist_non_global_ips: bool, true, def, true; + http_request_block_non_global_ips: bool, true, auto, |c| c.icon_blacklist_non_global_ips; /// Disable Two-Factor remember |> Enabling this would force the users to use a second factor to login every time. /// Note that the checkbox would still be present, but ignored. @@ -912,12 +911,12 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> { err!("To use email 2FA as automatic fallback, email 2fa has to be enabled!"); } - // Check if the icon blacklist regex is valid - if let Some(ref r) = cfg.http_request_blacklist_regex { + // Check if the HTTP request block regex is valid + if let Some(ref r) = cfg.http_request_block_regex { let validate_regex = regex::Regex::new(r); match validate_regex { Ok(_) => (), - Err(e) => err!(format!("`HTTP_REQUEST_BLACKLIST_REGEX` is invalid: {e:#?}")), + Err(e) => err!(format!("`HTTP_REQUEST_BLOCK_REGEX` is invalid: {e:#?}")), } } |