feat(server): admin-gate GET/POST /configure
This commit is contained in:
+3
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user