Simplify to memory system api
This commit is contained in:
12
memory_system_api/auth.py
Normal file
12
memory_system_api/auth.py
Normal file
@ -0,0 +1,12 @@
|
||||
"""API key auth for Memory System API."""
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import Header, HTTPException, status
|
||||
|
||||
from .config import get_config
|
||||
|
||||
|
||||
def verify_api_key(x_api_key: str | None = Header(default=None)) -> None:
|
||||
expected = get_config().server.api_key
|
||||
if expected and x_api_key != expected:
|
||||
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid API key")
|
||||
Reference in New Issue
Block a user