Class ApiAuthHealthCheck
- Namespace
- Virtufin.Api.HealthChecks
- Assembly
- Virtufin.Api.dll
Fails readiness when API-key auth is disabled (no keys configured)
outside Development. ApiKeyAuthOptions.Enabled => Keys.Count > 0 is a
deliberate zero-config local-dev default -- but the same empty-config
state reached by accident in a real deployment (a typo in
ApiAuth__Keys__<name>, a missing secret) would otherwise
silently run the sole externally-exposed gateway with no authentication
at all, with nothing surfacing it beyond a per-request log line. This
turns that into a blocked rollout/failed readiness probe instead.
public class ApiAuthHealthCheck : IHealthCheck
- Inheritance
-
ApiAuthHealthCheck
- Implements
- Inherited Members
Constructors
ApiAuthHealthCheck(ApiKeyAuthOptions, IHostEnvironment)
public ApiAuthHealthCheck(ApiKeyAuthOptions authOptions, IHostEnvironment environment)
Parameters
authOptionsApiKeyAuthOptionsenvironmentIHostEnvironment
Methods
CheckHealthAsync(HealthCheckContext, CancellationToken)
Runs the health check, returning the status of the component being checked.
public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
Parameters
contextHealthCheckContextA context object associated with the current execution.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel the health check.
Returns
- Task<HealthCheckResult>
A Task<TResult> that completes when the health check has finished, yielding the status of the component being checked.