mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-10 15:32:05 -03:30
fix: backport of looking for separated --spi arguments for the config (#31576)
closes: #31578 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
parent
3fdc78bab9
commit
c0ed46a011
@ -156,8 +156,7 @@ public class ConfigArgsConfigSource extends PropertiesConfigSource {
|
||||
// the weaknesses here:
|
||||
// - needs to know all of the short name options that accept a value
|
||||
// - does not know all of the picocli parsing rules. picocli will accept -cffile, and short option grouping - that's not accounted for
|
||||
// - does not understand spi options, they will be assumed to be unary
|
||||
if (mapper != null || SHORT_OPTIONS_ACCEPTING_VALUE.contains(key)) {
|
||||
if (mapper != null || SHORT_OPTIONS_ACCEPTING_VALUE.contains(key) || arg.startsWith("--spi")) {
|
||||
i++; // consume next as a value to the key
|
||||
value = args.get(i);
|
||||
} else {
|
||||
|
||||
@ -33,5 +33,12 @@ public class ConfigArgsConfigSourceTest {
|
||||
ConfigArgsConfigSource.parseConfigArgs(Arrays.asList("--key=value", "-cf", "file", "command", "arg", "--db", "value"), (key, value) -> values.add(key+'='+value), values::add);
|
||||
assertEquals(Arrays.asList("--key=value", "-cf=file", "command", "arg", "--db=value"), values);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseArgsWithSpi() {
|
||||
List<String> values = new ArrayList<>();
|
||||
ConfigArgsConfigSource.parseConfigArgs(Arrays.asList("--spi-some-thing-enabled=value", "--spi-some-thing-else", "other-value"), (key, value) -> values.add(key+'='+value), ignored -> {});
|
||||
assertEquals(Arrays.asList("--spi-some-thing-enabled=value", "--spi-some-thing-else=other-value"), values);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user