from fastapi import HTTPException, status from app.core.config import get_settings READ_ONLY_OPERATION_DISABLED = "This service is read-only; data mutation operations are disabled" def require_operations_enabled(detail: str = READ_ONLY_OPERATION_DISABLED) -> None: """Reject mutation-oriented endpoints when the product is running read-only.""" if get_settings().read_only_mode: raise HTTPException( status_code=status.HTTP_405_METHOD_NOT_ALLOWED, detail=detail, )