16 lines
494 B
Python
16 lines
494 B
Python
"""Small auth bridge used by the modular v1 router."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
from fastapi import Header, HTTPException, status
|
|
|
|
from .config import get_config
|
|
|
|
|
|
def verify_api_key_compat(x_api_key: Optional[str] = Header(default=None)) -> None:
|
|
expected_key = get_config().server.api_key
|
|
if expected_key and x_api_key != expected_key:
|
|
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid or missing API key")
|
|
|