Updated Database health_check
This commit is contained in:
parent
faffb42483
commit
4d0df2de07
|
@ -108,7 +108,7 @@ public class GeoportalHealth {
|
|||
public Response databaseCheck(@QueryParam("context") String context) throws JsonProcessingException {
|
||||
log.debug("databaseCheck called in the context {}", context);
|
||||
if (context == null) {
|
||||
HealthCheckResponse response = HealthCheckResponse.named(MongoHealthCheck.SERVICE_NAME)
|
||||
HealthCheckResponse response = HealthCheckResponse.named(DatabaseHealthCheck.SERVICE_NAME)
|
||||
.withData("context", "is required parameter (e.g. context=/gcube/devsec/devVRE)").down().build();
|
||||
String json = healthCheckSerializer(response);
|
||||
log.info("databaseCheck error response is {}", json);
|
||||
|
|
|
@ -114,7 +114,13 @@ public class DatabaseHealthCheck implements HealthCheck {
|
|||
private HealthCheckResponseBuilder appendDBInfo(HealthCheckResponseBuilder buildHCRBuilder,
|
||||
DatabaseConnection connection) {
|
||||
buildHCRBuilder.withData("host", connection.getUrl() + "");
|
||||
buildHCRBuilder.withData("user ", connection.getUser());
|
||||
|
||||
// anonymize the DB username
|
||||
String userNotClear = "***";
|
||||
if (connection.getUser() != null && connection.getUser().length() > 3) {
|
||||
userNotClear = connection.getUser().substring(0, 3) + userNotClear;
|
||||
}
|
||||
buildHCRBuilder.withData("user ", userNotClear);
|
||||
buildHCRBuilder.withData("pwd ", "****");
|
||||
return buildHCRBuilder;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue