unigateway 1.2.1

Lightweight, local-first LLM gateway for developers. A stable, single-binary unified entry point for all your AI tools and models.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::sync::Arc;

use axum::http::HeaderMap;

use crate::types::AppState;

pub(crate) async fn is_admin_authorized(state: &Arc<AppState>, headers: &HeaderMap) -> bool {
    if !state.config.admin_token.is_empty() {
        let token = headers
            .get("x-admin-token")
            .and_then(|v| v.to_str().ok())
            .unwrap_or_default();
        return token == state.config.admin_token;
    }
    true
}