from fastapi import Depends, HTTPException, status from fastapi.security import APIKeyHeader from app.config import get_settings api_key_header = APIKeyHeader(name=get_settings().API_KEY_NAME, auto_error=False) async def validate_api_key(api_key_header: str = Depends(api_key_header)): if api_key_header != get_settings().API_KEY: raise HTTPException( status_code=status.HTTP_403_FORBIDDEN, detail="Could not validate credentials" ) return api_key_header