1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-08-03 09:39:10 +00:00

Config option for client IP header

This commit is contained in:
Daniel García 2019-12-27 18:42:39 +01:00
commit 88c56de97b
No known key found for this signature in database
GPG key ID: FC8A7D14C3CD543A
3 changed files with 29 additions and 6 deletions

View file

@ -185,19 +185,24 @@ macro_rules! make_config {
}
}
}};
( @build $value:expr, $config:expr, gen, $default_fn:expr ) => {{
let f: &dyn Fn(&ConfigItems) -> _ = &$default_fn;
f($config)
}};
}
//STRUCTURE:
// /// Short description (without this they won't appear on the list)
// group {
// /// Friendly Name |> Description (Optional)
// name: type, is_editable, none_action, <default_value (Optional)>
// name: type, is_editable, action, <default_value (Optional)>
// }
//
// Where none_action applied when the value wasn't provided and can be:
// Where action applied when the value wasn't provided and can be:
// def: Use a default value
// auto: Value is auto generated based on other values
// option: Value is optional
// gen: Value is always autogenerated and it's original value ignored
make_config! {
folders {
/// Data folder |> Main data folder
@ -266,6 +271,11 @@ make_config! {
/// Advanced settings
advanced {
/// Client IP header |> If not present, the remote IP is used.
/// Set to the string "none" (without quotes), to disable any headers and just use the remote IP
ip_header: String, true, def, "X-Real-IP".to_string();
/// Internal IP header property, used to avoid recomputing each time
_ip_header_enabled: bool, false, gen, |c| &c.ip_header.trim().to_lowercase() != "none";
/// Positive icon cache expiry |> Number of seconds to consider that an already cached icon is fresh. After this period, the icon will be redownloaded
icon_cache_ttl: u64, true, def, 2_592_000;
/// Negative icon cache expiry |> Number of seconds before trying to download an icon that failed again.