pub fn build_router(state: Arc<ServerState>) -> RouterExpand description
Build the axum router with all API endpoints and OpenAPI doc routes.
Structure:
/api/v1/*— the main resource router, with the globalServerState::request_timeoutapplied as an outerTimeoutLayer.POST /powernow returns immediately with a PCS transition id (the polling loop runs CLI-side), so it fits well under the default timeout — no per-route override is needed. A second outer layer (read_only_guard) refuses mutating methods (POST/PUT/PATCH/DELETE) when the caller’s JWT carries theREAD_ONLY_ROLErole.
/api/v1/auth/*— separate sub-router with two layered defences: per-IP rate limit (seeAuthRateLimiter) and body redaction from any log span (seestrip_body_for_logs). No Bearer-token extractor (these endpoints issue the token)./docs+/openapi.json— Swagger UI and the spec fromApiDoc.- HSTS header injected on every response by an
add_hsts_headermiddleware (private to this module).