OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
feat: set Router enabled by default in Saas (#1831)
Edwin Jose58e8963f29c6
diff --git a/src/config/settings.py b/src/config/settings.pyindex 31ab1afe5..846072821 100644--- a/src/config/settings.py+++ b/src/config/settings.py@@ -76,7 +76,21 @@ OPENRAG_BACKEND_INTERNAL_URL = os.getenv(# pointed at the router instead of the backend internal URL, so Langflow's# reachable surface narrows to that single endpoint.INGEST_CALLBACK_PATH = "/internal/ingest/chunks"-OPENRAG_BACKEND_ROUTER_ENABLE = os.getenv("OPENRAG_BACKEND_ROUTER_ENABLE", "false").lower() in (+++# Default depends on OPENRAG_RUN_MODE:+# * saas -> "true" (the platform requires the narrowed surface)+# * anything else -> "false" (today's behaviour preserved)+# An explicit OPENRAG_BACKEND_ROUTER_ENABLE value always wins.+def _resolve_backend_router_enable_default() -> str:+ from utils.run_mode_utils import is_run_mode_saas++ return "true" if is_run_mode_saas() else "false"+++OPENRAG_BACKEND_ROUTER_ENABLE = os.getenv(+ "OPENRAG_BACKEND_ROUTER_ENABLE", _resolve_backend_router_enable_default()+).lower() in ("true","1","yes",@@ -304,10 +318,9 @@ DOCLING_SERVE_VERIFY_SSL = os.getenv("DOCLING_SERVE_VERIFY_SSL", "true").lower()# An explicit OPENRAG_SKIP_OS_SECURITY_SETUP value always wins, so an# operator can force-enable the setup in SaaS for a one-off bootstrap.def _resolve_skip_os_security_default() -> str:- run_mode = os.getenv("OPENRAG_RUN_MODE", "").strip().lower()- if run_mode in ("saas", "on_prem"):- return "true"- return "false"+ from utils.run_mode_utils import is_run_mode_on_prem, is_run_mode_saas++ return "true" if is_run_mode_saas() or is_run_mode_on_prem() else "false"OPENRAG_SKIP_OS_SECURITY_SETUP = os.getenv(diff --git a/tests/unit/test_backend_router.py b/tests/unit/test_backend_router.pyindex 567e523f2..e168e6cbc 100644--- a/tests/unit/test_backend_router.py+++ b/tests/unit/test_backend_router.py@@ -1,11 +1,34 @@"""Tests for the standalone ingestion-callback proxy router and the callback-URLselection helper that points Langflow at it."""+import pytestfrom fastapi.testclient import TestClientfrom app import router_appfrom config import settings+# --- run-mode-dependent enable default ---------------------------------------+++ "run_mode, expected",+ [+ ("", "false"), # unset -> default oss path+ ("oss", "false"),+ ("saas", "true"),+ ("SaaS", "true"),+ ("on_prem", "false"),+ ("unknown-mode", "false"),+ ],+)+def test_enable_default_resolves_from_run_mode(monkeypatch, run_mode, expected):+ if run_mode:+ monkeypatch.setenv("OPENRAG_RUN_MODE", run_mode)+ else:+ monkeypatch.delenv("OPENRAG_RUN_MODE", raising=False)+ assert settings._resolve_backend_router_enable_default() == expected++# --- callback URL selection -------------------------------------------------