Add generic memory gateway v1
This commit is contained in:
15
memory_gateway/server_auth.py
Normal file
15
memory_gateway/server_auth.py
Normal file
@ -0,0 +1,15 @@
|
||||
"""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")
|
||||
|
||||
Reference in New Issue
Block a user