Update app/api/routes_users.py
Browse files- app/api/routes_users.py +15 -0
app/api/routes_users.py
CHANGED
|
@@ -3,6 +3,7 @@ User endpoints – registration and quota information.
|
|
| 3 |
"""
|
| 4 |
|
| 5 |
import uuid
|
|
|
|
| 6 |
from fastapi import APIRouter, Depends, HTTPException, Request
|
| 7 |
from slowapi import Limiter
|
| 8 |
from slowapi.util import get_remote_address
|
|
@@ -54,3 +55,17 @@ async def get_user_quota(request: Request, quota: dict = Depends(enforce_quota))
|
|
| 54 |
"remaining": remaining,
|
| 55 |
"limit": limit,
|
| 56 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
|
| 5 |
import uuid
|
| 6 |
+
import os
|
| 7 |
from fastapi import APIRouter, Depends, HTTPException, Request
|
| 8 |
from slowapi import Limiter
|
| 9 |
from slowapi.util import get_remote_address
|
|
|
|
| 55 |
"remaining": remaining,
|
| 56 |
"limit": limit,
|
| 57 |
}
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# ===== DEBUG ENDPOINT – Remove in production =====
|
| 61 |
+
@router.get("/tracker-status")
|
| 62 |
+
async def tracker_status():
|
| 63 |
+
"""
|
| 64 |
+
Debug endpoint to check if the usage tracker is initialised.
|
| 65 |
+
Returns the tracker object and environment variables.
|
| 66 |
+
"""
|
| 67 |
+
return {
|
| 68 |
+
"tracker": str(tracker),
|
| 69 |
+
"env_tracking": os.getenv("ARF_USAGE_TRACKING"),
|
| 70 |
+
"env_db_path": os.getenv("ARF_USAGE_DB_PATH")
|
| 71 |
+
}
|