build_router_with_auth

Function build_router_with_auth 

Source
pub fn build_router_with_auth(
    router: Arc<RequestRouter>,
    ws_broadcaster: Arc<WsBroadcaster>,
    key_store: Arc<KeyStore>,
    counters: Arc<RuntimeCounters>,
) -> Router
Expand description

构建 REST API 路由,携带 KeyStore 做 Bearer Token 鉴权 + RuntimeCounters 做限额

key_store.is_configured() == false 时等价于 build_router(保持旧行为)。 counters 应由 main 全进程共享:REST / gRPC / MCP 共用一个实例才能保证 rate limit / 日累计跨接口一致