Skip to content

Commit

Permalink
feat: health-check should return starting if external authentication …
Browse files Browse the repository at this point in the history
…and dynamic scope is not started #1895

Signed-off-by: Yuriy Movchan <[email protected]>
  • Loading branch information
yurem committed Mar 14, 2024
1 parent eb824f2 commit 91dbf41
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.gluu.oxauth.service.external.ExternalAuthenticationService;
import org.gluu.oxauth.service.external.ExternalDynamicScopeService;
import org.gluu.persist.PersistenceEntryManager;

/**
Expand All @@ -23,14 +25,27 @@ public class HealthCheckController {
@Inject
private PersistenceEntryManager persistenceEntryManager;

@Inject
private ExternalAuthenticationService externalAuthenticationService;

@Inject
private ExternalDynamicScopeService externalDynamicScopeService;

@GET
@POST
@Path("/health-check")
@Produces(MediaType.APPLICATION_JSON)
public String healthCheckController() {
boolean isConnected = persistenceEntryManager.getOperationService().isConnected();
String dbStatus = isConnected ? "online" : "offline";
String dbStatus = isConnected ? "online" : "offline";
return "{\"status\": \"running\", \"db_status\":\"" + dbStatus + "\"}";
}

public String getAppStatus() {
if (externalAuthenticationService.isLoaded() && externalDynamicScopeService.isLoaded()) {
return "running";
} else {
retunr "starting";
}
}
}

0 comments on commit 91dbf41

Please sign in to comment.