From 6c06024cf905dc7d134436d173784cb0d1f599a9 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 6 Aug 2025 14:25:42 +0400 Subject: [PATCH] refac: scim --- backend/open_webui/config.py | 16 ---------------- backend/open_webui/env.py | 7 +++++++ backend/open_webui/main.py | 12 +++++------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index a63968421c..9f699d9e7c 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -855,22 +855,6 @@ ENABLE_DIRECT_CONNECTIONS = PersistentConfig( os.environ.get("ENABLE_DIRECT_CONNECTIONS", "True").lower() == "true", ) -#################################### -# SCIM Configuration -#################################### - -SCIM_ENABLED = PersistentConfig( - "SCIM_ENABLED", - "scim.enabled", - os.environ.get("SCIM_ENABLED", "False").lower() == "true", -) - -SCIM_TOKEN = PersistentConfig( - "SCIM_TOKEN", - "scim.token", - os.environ.get("SCIM_TOKEN", ""), -) - #################################### # OLLAMA_BASE_URL #################################### diff --git a/backend/open_webui/env.py b/backend/open_webui/env.py index 2505514dc9..c3f8f637ee 100644 --- a/backend/open_webui/env.py +++ b/backend/open_webui/env.py @@ -439,6 +439,13 @@ ENABLE_COMPRESSION_MIDDLEWARE = ( ) +#################################### +# SCIM Configuration +#################################### + +SCIM_ENABLED = os.environ.get("SCIM_ENABLED", "False").lower() == "true" +SCIM_TOKEN = os.environ.get("SCIM_TOKEN", "") + #################################### # LICENSE_KEY #################################### diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index ddb1f6573a..626d46be6b 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -117,14 +117,8 @@ from open_webui.config import ( OPENAI_API_CONFIGS, # Direct Connections ENABLE_DIRECT_CONNECTIONS, - - # SCIM - SCIM_ENABLED, - SCIM_TOKEN, - # Model list ENABLE_BASE_MODELS_CACHE, - # Thread pool size for FastAPI/AnyIO THREAD_POOL_SIZE, # Tool Server Configs @@ -426,6 +420,9 @@ from open_webui.env import ( WEBUI_AUTH_TRUSTED_EMAIL_HEADER, WEBUI_AUTH_TRUSTED_NAME_HEADER, WEBUI_AUTH_SIGNOUT_REDIRECT_URL, + # SCIM + SCIM_ENABLED, + SCIM_TOKEN, ENABLE_COMPRESSION_MIDDLEWARE, ENABLE_WEBSOCKET_SUPPORT, BYPASS_MODEL_ACCESS_CONTROL, @@ -1236,7 +1233,8 @@ app.include_router( app.include_router(utils.router, prefix="/api/v1/utils", tags=["utils"]) # SCIM 2.0 API for identity management -app.include_router(scim.router, prefix="/api/v1/scim/v2", tags=["scim"]) +if SCIM_ENABLED: + app.include_router(scim.router, prefix="/api/v1/scim/v2", tags=["scim"]) try: