OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
fix(security): Containerized Backend application is running as root
Mike Pawlowskif50523276e27
diff --git a/.env.example b/.env.exampleindex 75b6ea2d9..b626db73e 100644--- a/.env.example+++ b/.env.example@@ -232,3 +232,10 @@ SERVICE_NAME=openrag# Secret key for session management (auto-generated if not provided)SESSION_SECRET=+# OPTIONAL: The OpenRAG application execution mode or deployment target.+# - Used to configure the operation of the application based on it's execution context.+# Values:+# - "oss": Open Source Software (default)+# - "saas": Public Cloud+# - "on_prem": Private Cloud+OPENRAG_RUN_MODE=ossdiff --git a/src/utils/run_mode_utils.py b/src/utils/run_mode_utils.pynew file mode 100644index 000000000..a2dbd2314--- /dev/null+++ b/src/utils/run_mode_utils.py@@ -0,0 +1,36 @@+"""Utilities for determining the OpenRAG application run mode."""+import os++RUN_MODE_OSS: str = "oss"+RUN_MODE_SAAS: str = "saas"+RUN_MODE_ON_PREM: str = "on_prem"++_VALID_RUN_MODES = {RUN_MODE_OSS, RUN_MODE_SAAS, RUN_MODE_ON_PREM}+_DEFAULT_RUN_MODE = RUN_MODE_OSS+++def is_run_mode_oss() -> bool:+ """Return True if the current run mode is "oss"."""+ return get_run_mode() == RUN_MODE_OSS+++def is_run_mode_saas() -> bool:+ """Return True if the current run mode is "saas"."""+ return get_run_mode() == RUN_MODE_SAAS+++def is_run_mode_on_prem() -> bool:+ """Return True if the current run mode is "on_prem"."""+ return get_run_mode() == RUN_MODE_ON_PREM+++def get_run_mode() -> str:+ """Return the current OpenRAG run mode.++ Reads the OPENRAG_RUN_MODE environment variable. If unset or empty,+ defaults to "oss". If an unrecognized value is provided, defaults to "oss".+ """+ value = os.getenv("OPENRAG_RUN_MODE", "").strip().lower()+ if value in _VALID_RUN_MODES:+ return value+ return _DEFAULT_RUN_MODE