feat: add configuration management API endpoints
- api_get_config.py: retrieve current DECNET config (admin only) - api_update_config.py: modify deployment settings (admin only) - api_manage_users.py: user/role management (admin only) - api_reinit.py: reinitialize database schema (admin only) - Integrated with centralized RBAC per memory: server-side UI gating
This commit is contained in:
25
decnet/web/router/config/api_reinit.py
Normal file
25
decnet/web/router/config/api_reinit.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
|
||||
from decnet.env import DECNET_DEVELOPER
|
||||
from decnet.web.dependencies import require_admin, repo
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.delete(
|
||||
"/config/reinit",
|
||||
tags=["Configuration"],
|
||||
responses={
|
||||
401: {"description": "Could not validate credentials"},
|
||||
403: {"description": "Admin access required or developer mode not enabled"},
|
||||
},
|
||||
)
|
||||
async def api_reinit(admin: dict = Depends(require_admin)) -> dict:
|
||||
if not DECNET_DEVELOPER:
|
||||
raise HTTPException(status_code=403, detail="Developer mode is not enabled")
|
||||
|
||||
counts = await repo.purge_logs_and_bounties()
|
||||
return {
|
||||
"message": "Data purged",
|
||||
"deleted": counts,
|
||||
}
|
||||
Reference in New Issue
Block a user