Skip to content

Commit

Permalink
DGS-9450 Strip rule param prefix from configs
Browse files Browse the repository at this point in the history
  • Loading branch information
rayokota committed Dec 14, 2023
1 parent bfda9dd commit 78b1947
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -34,8 +34,10 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.concurrent.Callable;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine;
Expand All @@ -50,6 +52,8 @@ public class RegisterDeks implements Callable<Integer> {

private static final Logger LOG = LoggerFactory.getLogger(RegisterDeks.class);

private static final String RULE_PARAM_PREFIX = "rule.executors._default_.param.";

@Parameters(index = "0",
description = "SR (Schema Registry) URL", paramLabel = "<url>")
private String baseUrl;
Expand Down Expand Up @@ -92,7 +96,13 @@ public Integer call() throws Exception {
return 0;
}
try (FieldEncryptionExecutor executor = new FieldEncryptionExecutor()) {
executor.configure(configs);
Map<String, Object> ruleConfigs = configs.entrySet().stream()
.collect(Collectors.toMap(
e -> e.getKey().startsWith(RULE_PARAM_PREFIX)
? e.getKey().substring(RULE_PARAM_PREFIX.length())
: e.getKey(),
Entry::getValue));
executor.configure(ruleConfigs);
List<Rule> rules = parsedSchema.ruleSet().getDomainRules();
for (int i = 0; i < rules.size(); i++) {
Rule rule = rules.get(i);
Expand Down

0 comments on commit 78b1947

Please sign in to comment.