From a460ab7c9c53988f60d6d720ccafb7921d0a49d4 Mon Sep 17 00:00:00 2001 From: Giuseppe Baittiner Date: Mon, 11 Dec 2023 15:13:43 +0100 Subject: [PATCH] feat: add integrity check for props --- .../ms/gtw/rulesmanager/service/impl/ConfigSRV.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/impl/ConfigSRV.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/impl/ConfigSRV.java index a1a2513..c2b8347 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/impl/ConfigSRV.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/impl/ConfigSRV.java @@ -48,6 +48,7 @@ public void postConstruct() { }); } } + integrity(); } @Override @@ -70,4 +71,14 @@ private void refresh(ConfigItemTypeEnum type, String name) { String prop = client.getProps(type, name, previous); props.put(name, Pair.of(new Date().getTime(), prop)); } + + private void integrity() { + String err = "Missing props {} from rules-manager"; + String[] out = new String[]{ + PROPS_NAME_CONTROL_LOG_ENABLED, + }; + for (String prop : out) { + if(!props.containsKey(prop)) throw new IllegalStateException(err.replace("{}", prop)); + } + } }