diff options
author | mdecimus <mauro@stalw.art> | 2024-09-09 16:30:05 +0200 |
---|---|---|
committer | mdecimus <mauro@stalw.art> | 2024-09-09 16:30:05 +0200 |
commit | 1e0bde1008006b14ca016c1d2a96301bb61f6063 (patch) | |
tree | c03a7822f3925542228da25e54a70a2b266cda1c | |
parent | 3912fd00845af625e3f189cf2d9f74b1c3559f62 (diff) |
Fix: Local keys settings parsed incorrectly
-rw-r--r-- | crates/common/src/manager/config.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/common/src/manager/config.rs b/crates/common/src/manager/config.rs index ea30a64e..4cc5bae8 100644 --- a/crates/common/src/manager/config.rs +++ b/crates/common/src/manager/config.rs @@ -34,11 +34,13 @@ pub struct Patterns { patterns: Vec<Pattern>, } +#[derive(Debug)] enum Pattern { Include(MatchType), Exclude(MatchType), } +#[derive(Debug)] enum MatchType { Equal(String), StartsWith(String), @@ -469,9 +471,9 @@ impl Patterns { } let match_type = if value == "*" { MatchType::All - } else if let Some(value) = value.strip_prefix('*') { - MatchType::StartsWith(value.to_string()) } else if let Some(value) = value.strip_suffix('*') { + MatchType::StartsWith(value.to_string()) + } else if let Some(value) = value.strip_prefix('*') { MatchType::EndsWith(value.to_string()) } else if value.contains('*') { MatchType::Matches(GlobPattern::compile(&value, false)) @@ -485,6 +487,7 @@ impl Patterns { Pattern::Exclude(match_type) }); } + if cfg_local_patterns.is_empty() { cfg_local_patterns = vec![ Pattern::Include(MatchType::StartsWith("store.".to_string())), @@ -494,6 +497,7 @@ impl Patterns { Pattern::Exclude(MatchType::StartsWith("server.allowed-ip.".to_string())), Pattern::Include(MatchType::StartsWith("server.".to_string())), Pattern::Include(MatchType::StartsWith("certificate.".to_string())), + Pattern::Include(MatchType::StartsWith("config.local-keys.".to_string())), Pattern::Include(MatchType::StartsWith( "authentication.fallback-admin.".to_string(), )), |