Skip to main content

monitoring_auth_middleware

Function monitoring_auth_middleware 

Source
pub async fn monitoring_auth_middleware(
    __arg0: State<AdminState>,
    request: Request<Body>,
    next: Next,
) -> Response
Expand description

Middleware to protect monitoring endpoints.

If ADMIN_API_KEY is set, requires X-Admin-Key header to match. If ADMIN_API_KEY is not set, fails closed unless the runtime explicitly allows unauthenticated monitoring (development environment only).

These endpoints are authenticated for performance reasons - they execute synchronous database queries that could impact system performance under load.