Create dependencies.py
Browse files- app/dependencies.py +7 -0
app/dependencies.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import Header, HTTPException
|
| 2 |
+
|
| 3 |
+
API_KEY = "your-admin-key" # OR read from env/secrets
|
| 4 |
+
|
| 5 |
+
def require_api_key(x_api_key: str = Header(...)):
|
| 6 |
+
if x_api_key != API_KEY:
|
| 7 |
+
raise HTTPException(status_code=403, detail="Invalid API Key")
|