From b7c61b4e9487ac5ae85c784e6e1ed68aef3945b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Fri, 13 Dec 2024 11:25:53 +0100 Subject: [PATCH] config: backward compatibility with legacy princs filter Case-sensitive by default in case "princs" is used. --- common/src/models/config.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/src/models/config.rs b/common/src/models/config.rs index 19b2199..11c3f5d 100644 --- a/common/src/models/config.rs +++ b/common/src/models/config.rs @@ -182,14 +182,22 @@ struct ClientFilter { pub kind: crate::subscription::ClientFilterType, #[serde(default)] pub flags: crate::subscription::ClientFilterFlags, - #[serde(alias = "cert_subjects", alias = "princs")] + #[serde(default)] pub targets: HashSet, + + #[deprecated(since = "0.4.0", note = "Only for backward compatibility. Use targets instead")] + pub princs: Option>, } impl TryFrom for crate::subscription::ClientFilter { type Error = anyhow::Error; fn try_from(value: ClientFilter) -> std::prelude::v1::Result { + #[allow(deprecated)] + if let Some(princs) = value.princs { + return Ok(crate::subscription::ClientFilter::new_legacy(value.operation.into(), princs)); + } + crate::subscription::ClientFilter::try_new(value.operation.into(), value.kind, value.flags, value.targets) } }