8000 avoid SRCFG01008 warning for log-console-output=default in Quarkus dev mode by kowshik-04 · Pull Request #47746 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public static Boolean isRebuild() {
return Boolean.getBoolean("quarkus.launch.rebuild");
}

public static boolean isAugmentation() {
return isRebuild() || Boolean.getBoolean(KC_TEST_REBUILD) || LaunchMode.current() == LaunchMode.DEVELOPMENT;
}

public static Optional<String> getHomeDir() {
return Optional.ofNullable(System.getProperty(KC_HOME_DIR));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import io.smallrye.config.Expressions;
import org.jboss.logging.Logger;

import static org.keycloak.quarkus.runtime.Environment.isRebuild;
import static org.keycloak.quarkus.runtime.Environment.isRebuildCheck;
import static org.keycloak.quarkus.runtime.configuration.KeycloakConfigSourceProvider.isKeyStoreConfigSource;

Expand Down Expand Up @@ -82,7 +81,7 @@ public static ConfigValue getValue(ConfigSourceInterceptorContext context, Strin
// 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() || Boolean.getBoolean(Environment.KC_TEST_REBUILD)) && isKeycloakRuntime(name, mapper)
if (Environment.isAugmentation() && isKeycloakRuntime(name, mapper)
&& (NestedPropertyMappingInterceptor.getResolvingRoot().or(() -> Optional.of(name))
.filter(n -> n.startsWith("quarkus.log.") || n.startsWith("quarkus.console.")).isEmpty()
|| !Expressions.isEnabled())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import org.keycloak.quarkus.runtime.Environment;
import org.keycloak.quarkus.runtime.cli.PropertyException;

import io.quarkus.runtime.LaunchMode;
import io.quarkus.runtime.logging.LogRuntimeConfig;
import io.smallrye.config.Expressions;
import io.smallrye.config.SmallRyeConfig;
import org.hamcrest.CoreMatchers;
import org.junit.Test;
Expand Down Expand Up @@ -396,6 +398,19 @@ public void testNestedBuildTimeLogging() {
assertEquals("true", createConfig().getConfigValue("quarkus.log.console.enable").getValue());
}

@Test
public void testDefaultLogOutputIsHiddenDuringDevModeAugmentation() {
LaunchMode previousLaunchMode = LaunchMode.current();
LaunchMode.set(LaunchMode.DEVELOPMENT);

try {
SmallRyeConfig config = createConfig();
assertNull(Expressions.withoutExpansion(() -> config.getConfigValue("quarkus.log.console.json.enabled")).getValue());
} finally {
LaunchMode.set(previousLaunchMode);
}
}

@Test
public void asyncDefaults() {
initConfig();
Expand Down
0