From cbfd989ca9add7d2a6e3c3afe0b3ce9a7946310a Mon Sep 17 00:00:00 2001 From: Pedro Igor Date: Tue, 11 Jan 2022 00:21:38 -0800 Subject: [PATCH] Allow equal sign within option values (#9402) Closes #9397 --- .../runtime/configuration/ConfigArgsConfigSource.java | 2 +- .../runtime/configuration/test/ConfigurationTest.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/ConfigArgsConfigSource.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/ConfigArgsConfigSource.java index 54db629362..6e00088373 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/ConfigArgsConfigSource.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/ConfigArgsConfigSource.java @@ -172,7 +172,7 @@ public class ConfigArgsConfigSource extends PropertiesConfigSource { continue; } - String[] keyValue = ARG_KEY_VALUE_SPLIT.split(arg); + String[] keyValue = ARG_KEY_VALUE_SPLIT.split(arg, 2); String key = keyValue[0]; if ("".equals(key.trim())) { diff --git a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/test/ConfigurationTest.java b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/test/ConfigurationTest.java index 8e3484eaee..7ef768424e 100644 --- a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/test/ConfigurationTest.java +++ b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/test/ConfigurationTest.java @@ -373,6 +373,13 @@ public class ConfigurationTest { assertEquals("enabled", config.getConfigValue("quarkus.datasource.jdbc.transactions").getValue()); } + @Test + public void testOptionValueWithEqualSign() { + System.setProperty(CLI_ARGS, "--db-password=my_secret="); + SmallRyeConfig config = createConfig(); + assertEquals("my_secret=", config.getConfigValue("kc.db.password").getValue()); + } + private Config.Scope initConfig(String... scope) { Config.init(new MicroProfileConfigProvider(createConfig())); return Config.scope(scope);