Skip to content

Commit

Permalink
feat: add integrity check for props
Browse files Browse the repository at this point in the history
  • Loading branch information
gb-cic committed Dec 11, 2023
1 parent aecd144 commit 0aafba4
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.Map;

import static it.finanze.sanita.fse2.ms.gtw.statusmanager.client.routes.base.ClientRoutes.Config.*;
import static it.finanze.sanita.fse2.ms.gtw.statusmanager.dto.ConfigItemDTO.*;
import static it.finanze.sanita.fse2.ms.gtw.statusmanager.dto.ConfigItemDTO.ConfigDataItemDTO;
import static it.finanze.sanita.fse2.ms.gtw.statusmanager.enums.ConfigItemTypeEnum.STATUS_MANAGER;

@Slf4j
Expand Down Expand Up @@ -59,6 +59,7 @@ void initialize() {
});
}
}
integrity();
}

@Override
Expand Down Expand Up @@ -111,4 +112,16 @@ 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 status-manager";
String[] out = new String[]{
PROPS_NAME_EXP_DAYS,
PROPS_NAME_SUBJECT,
PROPS_NAME_ISSUER_CF
};
for (String prop : out) {
if(!props.containsKey(prop)) throw new IllegalStateException(err.replace("{}", prop));
}
}
}

0 comments on commit 0aafba4

Please sign in to comment.