Skip to content

Commit

Permalink
KOGITO-9757 Fixed regex
Browse files Browse the repository at this point in the history
Signed-off-by: Helber Belmiro <[email protected]>
  • Loading branch information
hbelmiro committed Aug 28, 2023
1 parent 8608672 commit d4f728a
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,24 @@
*/
package org.kie.kogito.addons.quarkus.k8s.config;

import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import io.smallrye.config.ConfigValue;
import org.kie.kogito.addons.k8s.resource.catalog.KubernetesProtocol;

class ConfigValueExpander {

private static final Pattern placeholderPattern = Pattern.compile("\\$\\{([^}]+)}");
private static final Pattern placeholderPattern = createPlaceholderPattern();

private static Pattern createPlaceholderPattern() {
String protocols = Arrays.stream(KubernetesProtocol.values())
.map(KubernetesProtocol::getValue)
.collect(Collectors.joining("|"));
return Pattern.compile("\\$\\{(" + protocols + "):.+}");
}

private final KubeDiscoveryConfigCache kubeDiscoveryConfigCache;

Expand Down

0 comments on commit d4f728a

Please sign in to comment.