Spaces:
Running
Running
| from fastapi import Header, HTTPException, status | |
| from src.config import settings | |
| async def verify_api_key(x_api_key: str = Header(...)): | |
| """Validates the client's API Key against settings to prevent unauthorized usage.""" | |
| if x_api_key != settings.API_KEY: | |
| raise HTTPException( | |
| status_code=status.HTTP_401_UNAUTHORIZED, | |
| detail="Invalid or missing API key." | |
| ) | |
| return x_api_key | |