mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-07 14:02:04 -03:30
fix: ensuring that Keycloak test launch doesn't capture runtime defaults (#45154)
closes: #41630 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
parent
4a2ed7c4e6
commit
d27db0adf7
@ -39,6 +39,7 @@ public final class Environment {
|
||||
|
||||
public static final String KC_CONFIG_REBUILD_CHECK = "kc.config.rebuild-check";
|
||||
public static final String KC_CONFIG_BUILT = "kc.config.built";
|
||||
public static final String KC_TEST_REBUILD = "kc.test.rebuild";
|
||||
private static final String KC_HOME_DIR = "kc.home.dir";
|
||||
public static final String NON_SERVER_MODE = "nonserver";
|
||||
public static final String PROFILE ="kc.profile";
|
||||
|
||||
@ -75,13 +75,13 @@ public final class PropertyMappers {
|
||||
public static ConfigValue getValue(ConfigSourceInterceptorContext context, String name) {
|
||||
PropertyMapper<?> mapper = getMapper(name);
|
||||
|
||||
// During re-aug do not resolve server runtime properties and avoid they included by quarkus in the default value config source.
|
||||
// During re-aug do not resolve server runtime properties and avoid including in the quarkus default value config source.
|
||||
//
|
||||
// The special handling of log properties is because some logging runtime properties are requested during build time
|
||||
// and we need to resolve them. That should be fine as they are generally not considered security sensitive.
|
||||
// If however expressions are not enabled that means quarkus is specifically looking for runtime defaults, and we should not provide a value
|
||||
// See https://github.com/quarkusio/quarkus/pull/42157
|
||||
if (isRebuild() && isKeycloakRuntime(name, mapper)
|
||||
if ((isRebuild() || Boolean.getBoolean(Environment.KC_TEST_REBUILD)) && isKeycloakRuntime(name, mapper)
|
||||
&& (NestedPropertyMappingInterceptor.getResolvingRoot().or(() -> Optional.of(name))
|
||||
.filter(n -> n.startsWith("quarkus.log.") || n.startsWith("quarkus.console.")).isEmpty()
|
||||
|| !Expressions.isEnabled())) {
|
||||
|
||||
@ -205,7 +205,9 @@ public class Keycloak {
|
||||
AugmentAction action = curated.createAugmentor();
|
||||
Environment.setHomeDir(homeDir);
|
||||
ConfigArgsConfigSource.setCliArgs(args.toArray(new String[0]));
|
||||
System.setProperty(Environment.KC_TEST_REBUILD, "true");
|
||||
StartupAction startupAction = action.createInitialRuntimeApplication();
|
||||
System.getProperties().remove(Environment.KC_TEST_REBUILD);
|
||||
|
||||
application = startupAction.runMainClass(args.toArray(new String[0]));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user