feat(server): admin-gate GET/POST /configure

This commit is contained in:
Mgeeeek
2026-05-13 21:01:30 +05:30
parent 8bd7b913c6
commit 6ba334ef94
3 changed files with 111 additions and 5 deletions
+3 -3
View File
@@ -13,7 +13,7 @@ from slowapi import _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from sqlalchemy import func, select
from auth import ADMIN_API_KEY, AUTH_DISABLED, JWT_SECRET, verify_auth
from auth import ADMIN_API_KEY, AUTH_DISABLED, JWT_SECRET, require_admin, verify_auth
from errors import (
UpstreamError,
install_request_id_logging,
@@ -301,7 +301,7 @@ async def log_requests(request: Request, call_next):
@app.get("/configure", summary="Get current Mem0 configuration")
def get_config(_auth=Depends(verify_auth)):
def get_config(_admin=Depends(require_admin)):
return _redact_config(get_current_config())
@@ -311,7 +311,7 @@ def list_bundled_providers(_auth=Depends(verify_auth)):
@app.post("/configure", summary="Configure Mem0")
def set_config(config: Dict[str, Any], _auth=Depends(verify_auth)):
def set_config(config: Dict[str, Any], _admin=Depends(require_admin)):
"""Set memory configuration."""
_validate_bundled_providers(config)
update_config(config)