Skip to content

Commit

Permalink
LTS 3.15.1
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 4, 2024
1 parent 3cebd7f commit fe74c2d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
package io.quarkiverse.loggingmanager.deployment;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;

@ConfigRoot
public class LoggingManagerConfig {
@ConfigMapping(prefix = "quarkus.logging-manager")
@ConfigRoot(phase = ConfigPhase.BUILD_TIME)
public interface LoggingManagerConfig {

/**
* The base path
*/
@ConfigItem(defaultValue = "logging-manager")
String basePath;
@WithDefault("logging-manager")
String basePath();

/**
* Whether to include the Logger Manager endpoints in the generated OpenAPI document
*/
@ConfigItem(name = "openapi.included", defaultValue = "false")
boolean openapiIncluded;
@WithName("openapi.included")
@WithDefault("false")
boolean openapiIncluded();

/**
* The tag to use if OpenAPI is included
*/
@ConfigItem(defaultValue = "Logging-manager")
String openapiTag;
@WithDefault("logging-manager")
String openapiTag();

/**
* Always include this. By default, this will always be included.
* Setting this to false will also exclude this in Prod
*/
@ConfigItem(defaultValue = "true")
boolean alwaysInclude;
}
@WithDefault("true")
boolean alwaysInclude();
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static class OpenAPIIncluded implements BooleanSupplier {
LoggingManagerConfig config;

public boolean getAsBoolean() {
return config.openapiIncluded;
return config.openapiIncluded();
}
}

Expand All @@ -48,7 +48,7 @@ void includeRestEndpoints(BuildProducer<RouteBuildItem> routeProducer,
LoggingManagerRuntimeConfig runtimeConfig,
ManagementInterfaceBuildTimeConfig managementConfig) {

if ("/".equals(loggingManagerConfig.basePath)) {
if ("/".equals(loggingManagerConfig.basePath())) {
throw new ConfigurationException(
"quarkus.logging-manager.base-path was set to \"/\", this is not allowed as it blocks the application from serving anything else.");
}
Expand All @@ -59,15 +59,15 @@ void includeRestEndpoints(BuildProducer<RouteBuildItem> routeProducer,

routeProducer.produce(nonApplicationRootPathBuildItem.routeBuilder()
.management()
.routeFunction(loggingManagerConfig.basePath,
.routeFunction(loggingManagerConfig.basePath(),
recorder.routeConsumer(bodyHandlerBuildItem.getHandler(), runtimeConfig))
.displayOnNotFoundPage("All available loggers")
.handler(loggerHandler)
.build());

routeProducer.produce(nonApplicationRootPathBuildItem.routeBuilder()
.management()
.nestedRoute(loggingManagerConfig.basePath, "levels")
.nestedRoute(loggingManagerConfig.basePath(), "levels")
.displayOnNotFoundPage("All available log levels")
.handler(levelHandler)
.build());
Expand All @@ -86,19 +86,19 @@ public void includeInOpenAPIEndpoint(BuildProducer<AddToOpenAPIDefinitionBuildIt
if (capabilities.isPresent(Capability.SMALLRYE_OPENAPI)
&& shouldIncludeInOpenAPI(launchMode, loggingManagerConfig, managementConfig)) {
LoggingManagerOpenAPIFilter filter = new LoggingManagerOpenAPIFilter(
nonApplicationRootPathBuildItem.resolvePath(loggingManagerConfig.basePath),
loggingManagerConfig.openapiTag);
nonApplicationRootPathBuildItem.resolvePath(loggingManagerConfig.basePath()),
loggingManagerConfig.openapiTag());
openAPIProducer.produce(new AddToOpenAPIDefinitionBuildItem(filter));
}
}

private static boolean shouldInclude(LaunchModeBuildItem launchMode, LoggingManagerConfig loggingManagerConfig) {
return launchMode.getLaunchMode().isDevOrTest() || loggingManagerConfig.alwaysInclude;
return launchMode.getLaunchMode().isDevOrTest() || loggingManagerConfig.alwaysInclude();
}

private static boolean shouldIncludeInOpenAPI(LaunchModeBuildItem launchMode, LoggingManagerConfig loggingManagerConfig,
ManagementInterfaceBuildTimeConfig managementConfig) {
return !managementConfig.enabled && shouldInclude(launchMode, loggingManagerConfig);
}

}
}
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.quarkiverse</groupId>
<artifactId>quarkiverse-parent</artifactId>
<version>17</version>
<version>18</version>
</parent>

<groupId>io.quarkiverse.loggingmanager</groupId>
Expand All @@ -31,7 +31,7 @@
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>3.8.5</quarkus.version>
<quarkus.version>3.15.1</quarkus.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -80,4 +80,4 @@
</modules>
</profile>
</profiles>
</project>
</project>

0 comments on commit fe74c2d

Please sign in to comment.