fixed log
This commit is contained in:
parent
86ede6d3df
commit
d3f891453a
1 changed files with 0 additions and 27 deletions
|
|
@ -274,33 +274,6 @@ def revoke_tokens_by_mandate(
|
||||||
raise HTTPException(status_code=500, detail="Failed to revoke mandate tokens")
|
raise HTTPException(status_code=500, detail="Failed to revoke mandate tokens")
|
||||||
|
|
||||||
|
|
||||||
# ----------------------
|
|
||||||
# Logs download
|
|
||||||
# ----------------------
|
|
||||||
|
|
||||||
@router.get("/logs/{log_name}")
|
|
||||||
@limiter.limit("60/minute")
|
|
||||||
def download_log(
|
|
||||||
request: Request,
|
|
||||||
currentUser: User = Depends(requireSysAdmin),
|
|
||||||
log_name: str = "poweron"
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Download server logs.
|
|
||||||
MULTI-TENANT: SysAdmin-only (infrastructure management).
|
|
||||||
"""
|
|
||||||
base_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
||||||
# base_dir -> gateway
|
|
||||||
if log_name == "poweron":
|
|
||||||
file_path = os.path.join(base_dir, "poweron.log")
|
|
||||||
elif log_name == "audit":
|
|
||||||
file_path = os.path.join(base_dir, "audit.log")
|
|
||||||
else:
|
|
||||||
raise HTTPException(status_code=400, detail="Unsupported log name")
|
|
||||||
|
|
||||||
if not os.path.exists(file_path):
|
|
||||||
raise HTTPException(status_code=404, detail=f"{log_name}.log not found")
|
|
||||||
return FileResponse(path=file_path, filename=f"{log_name}.log")
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------
|
# ----------------------
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue