Skip to content

Commit

Permalink
Merge pull request #12 from maddingo/feature/actuator-buildinfo
Browse files Browse the repository at this point in the history
show config in info actuator endpoint
  • Loading branch information
maddingo authored Feb 22, 2024
2 parents 6f91b8f + 042508f commit cdf8a2e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
6 changes: 5 additions & 1 deletion plantuml-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down Expand Up @@ -82,7 +86,7 @@
<execution>
<id>spring-boot-package</id>
<phase>package</phase>
<goals><goal>repackage</goal></goals>
<goals><goal>repackage</goal><goal>build-info</goal></goals>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package net.sourceforge.plantuml.server;

import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.stereotype.Component;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;

@Component
public class AuthUrlInfoContributor implements InfoContributor {
private final PlantumlConfigProperties plantumlConfigProperties;

public AuthUrlInfoContributor(PlantumlConfigProperties plantumlConfigProperties) {
this.plantumlConfigProperties = plantumlConfigProperties;
}

@Override
public void contribute(Info.Builder builder) {
Map<String, PlantumlConfigProperties.HttpAuthConfig> http = plantumlConfigProperties.getHttp();
if (http != null) {
Map<String, Object> httpMap = new LinkedHashMap<>();
http.forEach((key, value) -> httpMap.put(key, Map.of(
"url", value.getUrl(),
"username", value.getUsername(),
"password", Optional.ofNullable(value.getPassword()).map(p -> "****").orElse("empty")
)));
builder.withDetail("plantuml", Map.of("http", httpMap));
}
}
}
15 changes: 12 additions & 3 deletions plantuml-web/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
debug: false
spring:
jmx:
enabled: false
#spring:
# jmx:
# enabled: false

management:
endpoints:
web:
exposure:
include: "health,info"
endpoint:
info:
enabled: true

plantuml:
http:
Expand Down

0 comments on commit cdf8a2e

Please sign in to comment.