Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #2111 split the HealthConfig to a health-config module #2112

Merged
merged 1 commit into from
Feb 10, 2024
Merged
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
21 changes: 0 additions & 21 deletions header-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,10 @@
<groupId>com.networknt</groupId>
<artifactId>utility</artifactId>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>status</artifactId>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>exception</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.owasp.encoder</groupId>
<artifactId>encoder</artifactId>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
Expand All @@ -69,11 +53,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>client</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
58 changes: 58 additions & 0 deletions health-config/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!--
~ Copyright (c) 2016 Network New Technologies Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.networknt</groupId>
<artifactId>light-4j</artifactId>
<version>2.1.32-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>health-config</artifactId>
<packaging>jar</packaging>
<description>A module that contains HealthConfig to be shared with light-aws-lambda</description>

<dependencies>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>config</artifactId>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>utility</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
9 changes: 9 additions & 0 deletions health-config/src/main/java/module-info.j
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module com.networknt.health {
exports com.networknt.health;

requires com.networknt.handler;

requires undertow.core;
requires org.slf4j;
requires java.logging;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Server health endpoint that can output OK to indicate the server is alive

# true to enable this middleware handler. By default the health check is enabled.
# true to enable this middleware handler. By default, the health check is enabled.
enabled: ${health.enabled:true}
# true to return Json format message. By default, it is false. It will only be changed to true if the monitor
# tool only support JSON response body.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.networknt.health;

import org.junit.Test;

public class HealthConfigTest {
@Test
public void testLoad() {
HealthConfig config = HealthConfig.load();
assert(config != null);
}
}
49 changes: 49 additions & 0 deletions health-config/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016 Network New Technologies Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<configuration>
<turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
<Marker>PROFILER</Marker>
<!--<OnMatch>DENY</OnMatch>-->
<OnMatch>NEUTRAL</OnMatch>
</turboFilter>

<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5marker %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<appender name="log" class="ch.qos.logback.core.FileAppender">
<File>target/test.log</File>
<Append>false</Append>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %class{36}:%L %M - %msg%n</Pattern>
</layout>
</appender>

<root level="trace">
<appender-ref ref="stdout"/>
</root>

<logger name="com.networknt" level="trace">
<appender-ref ref="log"/>
</logger>

</configuration>
4 changes: 4 additions & 0 deletions health/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
<groupId>com.networknt</groupId>
<artifactId>handler</artifactId>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>health-config</artifactId>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<module>audit-config</module>
<module>dump</module>
<module>info</module>
<module>health-config</module>
<module>health</module>
<module>status</module>
<module>exception</module>
Expand Down Expand Up @@ -251,6 +252,11 @@
<artifactId>info</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>health-config</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>health</artifactId>
Expand Down