-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show config in info actuator endpoint
- Loading branch information
Martin Goldhahn
committed
Feb 22, 2024
1 parent
6f91b8f
commit 042508f
Showing
3 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
plantuml-web/src/main/java/net/sourceforge/plantuml/server/AuthUrlInfoContributor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters