-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add okta call and update script config
- Loading branch information
Showing
9 changed files
with
1,170 additions
and
1,131 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: 22 additions & 10 deletions
32
...main/java/gov/cdc/usds/simplereport/api/heathcheck/BackendAndDatabaseHealthIndicator.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 |
---|---|---|
@@ -1,26 +1,38 @@ | ||
package gov.cdc.usds.simplereport.api.heathcheck; | ||
|
||
import com.okta.sdk.resource.api.GroupApi; | ||
import com.okta.sdk.resource.client.ApiException; | ||
import gov.cdc.usds.simplereport.db.repository.FeatureFlagRepository; | ||
import gov.cdc.usds.simplereport.idp.repository.LiveOktaRepository; | ||
import gov.cdc.usds.simplereport.idp.repository.OktaRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.hibernate.exception.JDBCConnectionException; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.actuate.health.Health; | ||
import org.springframework.boot.actuate.health.HealthIndicator; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component("prod-smoke-test") | ||
@Component("backend-and-db-smoke-test") | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class BackendAndDatabaseHealthIndicator implements HealthIndicator { | ||
private final FeatureFlagRepository _ffRepo; | ||
private final FeatureFlagRepository _ffRepo; | ||
private final OktaRepository _oktaRepo; | ||
|
||
@Override | ||
public Health health() { | ||
try { | ||
_ffRepo.findAll(); | ||
return Health.up().build(); | ||
} catch (JDBCConnectionException e) { | ||
return Health.down().build(); | ||
@Override | ||
public Health health() { | ||
try { | ||
_ffRepo.findAll(); | ||
_oktaRepo.getConnectTimeoutForHealthCheck(); | ||
|
||
return Health.up().build(); | ||
} catch (JDBCConnectionException e) { | ||
return Health.down().build(); | ||
// Okta API call errored | ||
} catch (ApiException e) { | ||
log.info(e.getMessage()); | ||
return Health.down().build(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.