[PR #17433] [CLOSED] refactor: split legacy config file into smaller chunks (3/4) #95467

Closed
opened 2026-05-15 21:38:34 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/17433
Author: @luxass
Created: 9/14/2025
Status: Closed

Base: devHead: refactor/split-legacy-config


📝 Commits (10+)

  • 5ee3521 refactor: move config.py into config/ package structure
  • 61ce6c4 refactor(logging): move logging setup to a dedicated module
  • c9639dd refactor(config): reorganize configuration modules and enhance structure
  • d300bdf chore: format
  • 5efefcb Merge branch 'dev' into refactor/move-to-config-module
  • 8b67a4a Merge branch 'dev' into refactor/move-to-config-module
  • 5d1ae32 chore: format
  • 56bfb79 Merge branch 'refactor/move-to-config-module' into refactor/extract-core-config
  • 3b71b86 refactor(config): reorganize imports and create llm module
  • e0a2faa feat(config): add authentication configuration module

📊 Changes

36 files changed (+3737 additions, -3505 deletions)

View changed files

backend/open_webui/config.py (+0 -3483)
backend/open_webui/config/__init__.py (+8 -0)
backend/open_webui/config/core/__init__.py (+8 -0)
backend/open_webui/config/core/auth.py (+638 -0)
backend/open_webui/config/core/base.py (+171 -0)
backend/open_webui/config/core/database.py (+80 -0)
backend/open_webui/config/core/logging.py (+15 -0)
backend/open_webui/config/features/__init__.py (+11 -0)
backend/open_webui/config/features/admin.py (+36 -0)
backend/open_webui/config/features/features.py (+72 -0)
backend/open_webui/config/features/misc.py (+98 -0)
backend/open_webui/config/features/permissions.py (+211 -0)
backend/open_webui/config/features/static.py (+113 -0)
backend/open_webui/config/features/tasks.py (+311 -0)
backend/open_webui/config/features/ui.py (+134 -0)
backend/open_webui/config/integrations/__init__.py (+10 -0)
backend/open_webui/config/integrations/code_interpreter.py (+133 -0)
backend/open_webui/config/integrations/llm.py (+127 -0)
backend/open_webui/config/integrations/media.py (+455 -0)
backend/open_webui/config/integrations/retrieval.py (+865 -0)

...and 16 more files

📄 Description

⚠️ DEPENDS ON PR #17431

This PR builds on the changes from PR #17431. The diff currently shows cumulative changes from both PRs. Once PR #17431 is merged, I will rebase this branch and the diff will show only the changes specific to this PR.

Part 3/4 of the config refactoring series.

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

Complete the modularization of configuration by organizing remaining components from config/legacy.py into a hierarchical structure with core/, features/, and integrations/ subdirectories. This improved organization provides better logical separation than the original flat structure, making the codebase more maintainable and easier to navigate. This is part 3 of 4 in the config.py refactoring series.

Added

  • config/core/ package: Fundamental system components

    • auth.py: Authentication, OAuth, security settings, and user management configurations
    • Moved from legacy.py: WEBUI_AUTH, OAuth providers, security tokens, session management
  • config/features/ package: Application feature configurations

    • admin.py: Administrative settings and controls
    • features.py: Feature toggles and experimental functionality controls
    • misc.py: Miscellaneous application settings and general configurations
    • permissions.py: User permissions, role management, and access control settings
    • static.py: Static file serving, paths, and asset configuration
    • tasks.py: Background task configuration, scheduling, and processing settings
    • ui.py: User interface customization, themes, and presentation settings
  • config/integrations/ package: External service integrations

    • code_interpreter.py: Code execution and interpretation service configurations
    • llm.py: Large Language Model configurations (Ollama, OpenAI, etc.)
    • media.py: Image generation (AUTOMATIC1111, ComfyUI), STT, TTS configurations
    • retrieval.py: RAG (Retrieval Augmented Generation) and document processing settings
    • storage.py: File storage, data persistence, and backup configurations
    • vector.py: Vector database (Qdrant, etc.) and embedding configurations

Changed

  • Improved architectural organization: Replaced planned flat structure with logical hierarchy
  • Enhanced maintainability: Related configurations grouped into coherent packages
  • Better developer experience: Easier to locate and modify specific configuration areas
  • Clearer separation of concerns: Core vs Features vs Integrations distinction
  • Updated import structure: All packages properly expose their configurations through __init__.py

Deprecated

  • None

Removed

  • All remaining configuration code from config/legacy.py (distributed across the new hierarchical structure)
  • Legacy flat file approach in favor of organized package structure

Fixed

  • None

Security

  • None

Breaking Changes

  • No breaking changes - All existing functionality and import patterns continue to work unchanged

Additional Information

  • This is part 3 of 4 in a comprehensive config.py refactoring series
  • Architectural improvement: Changed from planned flat structure to hierarchical organization during implementation
  • 100% backward compatibility maintained - no existing code needs updates
  • See discussion: #17429 for the complete refactoring plan

Improved File Structure

The new hierarchical organization provides clear logical separation:

config/
├── core/          # Fundamental system components
│   ├── auth.py    # Authentication & security 
│   ├── base.py    # Core config classes 
│   ├── database.py # Database configuration
│   └── logging.py # Logging setup
├── features/      # Application feature settings
│   ├── admin.py   # Administrative controls
│   ├── features.py # Feature toggles
│   ├── misc.py    # General settings
│   ├── permissions.py # Access control
│   ├── static.py  # Static file serving
│   ├── tasks.py   # Background tasks
│   └── ui.py      # User interface
└── integrations/ # External service configs
    ├── code_interpreter.py # Code execution
    ├── llm.py     # LLM providers
    ├── media.py   # Image/audio generation
    ├── retrieval.py # RAG and documents
    ├── storage.py # File storage
    └── vector.py  # Vector databases

Screenshots or Videos

  • [Attach any relevant screenshots or videos demonstrating the changes]

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/17433 **Author:** [@luxass](https://github.com/luxass) **Created:** 9/14/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `refactor/split-legacy-config` --- ### 📝 Commits (10+) - [`5ee3521`](https://github.com/open-webui/open-webui/commit/5ee3521647152a91e29b4bd4c81bed221af29dea) refactor: move config.py into config/ package structure - [`61ce6c4`](https://github.com/open-webui/open-webui/commit/61ce6c47045105ff9cb63e6e7b8368667c2eed2b) refactor(logging): move logging setup to a dedicated module - [`c9639dd`](https://github.com/open-webui/open-webui/commit/c9639dd8bdd54de4c11345bb84d9f0618b1dda67) refactor(config): reorganize configuration modules and enhance structure - [`d300bdf`](https://github.com/open-webui/open-webui/commit/d300bdf4bf1a2ac9b4d1bd2954e6d9d1e4d374e5) chore: format - [`5efefcb`](https://github.com/open-webui/open-webui/commit/5efefcbad6452fa2d7e4cf44d61cd2ac25cbc3fc) Merge branch 'dev' into refactor/move-to-config-module - [`8b67a4a`](https://github.com/open-webui/open-webui/commit/8b67a4aad31736e028ce4344c183c777c4d5a736) Merge branch 'dev' into refactor/move-to-config-module - [`5d1ae32`](https://github.com/open-webui/open-webui/commit/5d1ae32ed9ac7bef76ca3d70c128f74ae3add1c1) chore: format - [`56bfb79`](https://github.com/open-webui/open-webui/commit/56bfb794fac197ffccbedbd9078ba02eae9344d7) Merge branch 'refactor/move-to-config-module' into refactor/extract-core-config - [`3b71b86`](https://github.com/open-webui/open-webui/commit/3b71b866577baee3119b527c6c813041c0d723be) refactor(config): reorganize imports and create llm module - [`e0a2faa`](https://github.com/open-webui/open-webui/commit/e0a2faaad7f8f43053d13d0356128b1ff3ef2456) feat(config): add authentication configuration module ### 📊 Changes **36 files changed** (+3737 additions, -3505 deletions) <details> <summary>View changed files</summary> ➖ `backend/open_webui/config.py` (+0 -3483) ➕ `backend/open_webui/config/__init__.py` (+8 -0) ➕ `backend/open_webui/config/core/__init__.py` (+8 -0) ➕ `backend/open_webui/config/core/auth.py` (+638 -0) ➕ `backend/open_webui/config/core/base.py` (+171 -0) ➕ `backend/open_webui/config/core/database.py` (+80 -0) ➕ `backend/open_webui/config/core/logging.py` (+15 -0) ➕ `backend/open_webui/config/features/__init__.py` (+11 -0) ➕ `backend/open_webui/config/features/admin.py` (+36 -0) ➕ `backend/open_webui/config/features/features.py` (+72 -0) ➕ `backend/open_webui/config/features/misc.py` (+98 -0) ➕ `backend/open_webui/config/features/permissions.py` (+211 -0) ➕ `backend/open_webui/config/features/static.py` (+113 -0) ➕ `backend/open_webui/config/features/tasks.py` (+311 -0) ➕ `backend/open_webui/config/features/ui.py` (+134 -0) ➕ `backend/open_webui/config/integrations/__init__.py` (+10 -0) ➕ `backend/open_webui/config/integrations/code_interpreter.py` (+133 -0) ➕ `backend/open_webui/config/integrations/llm.py` (+127 -0) ➕ `backend/open_webui/config/integrations/media.py` (+455 -0) ➕ `backend/open_webui/config/integrations/retrieval.py` (+865 -0) _...and 16 more files_ </details> ### 📄 Description **⚠️ DEPENDS ON PR #17431** This PR builds on the changes from PR #17431. The diff currently shows cumulative changes from both PRs. Once PR #17431 is merged, I will rebase this branch and the diff will show only the changes specific to this PR. **Part 3/4** of the config refactoring series. # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [x] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Have you written and run sufficient tests to validate the changes? - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description Complete the modularization of configuration by organizing remaining components from `config/legacy.py` into a hierarchical structure with `core/`, `features/`, and `integrations/` subdirectories. This improved organization provides better logical separation than the original flat structure, making the codebase more maintainable and easier to navigate. This is part 3 of 4 in the config.py refactoring series. ### Added - **`config/core/` package**: Fundamental system components - **`auth.py`**: Authentication, OAuth, security settings, and user management configurations - Moved from legacy.py: WEBUI_AUTH, OAuth providers, security tokens, session management - **`config/features/` package**: Application feature configurations - **`admin.py`**: Administrative settings and controls - **`features.py`**: Feature toggles and experimental functionality controls - **`misc.py`**: Miscellaneous application settings and general configurations - **`permissions.py`**: User permissions, role management, and access control settings - **`static.py`**: Static file serving, paths, and asset configuration - **`tasks.py`**: Background task configuration, scheduling, and processing settings - **`ui.py`**: User interface customization, themes, and presentation settings - **`config/integrations/` package**: External service integrations - **`code_interpreter.py`**: Code execution and interpretation service configurations - **`llm.py`**: Large Language Model configurations (Ollama, OpenAI, etc.) - **`media.py`**: Image generation (AUTOMATIC1111, ComfyUI), STT, TTS configurations - **`retrieval.py`**: RAG (Retrieval Augmented Generation) and document processing settings - **`storage.py`**: File storage, data persistence, and backup configurations - **`vector.py`**: Vector database (Qdrant, etc.) and embedding configurations ### Changed - **Improved architectural organization**: Replaced planned flat structure with logical hierarchy - **Enhanced maintainability**: Related configurations grouped into coherent packages - **Better developer experience**: Easier to locate and modify specific configuration areas - **Clearer separation of concerns**: Core vs Features vs Integrations distinction - **Updated import structure**: All packages properly expose their configurations through `__init__.py` ### Deprecated - None ### Removed - **All remaining configuration code from `config/legacy.py`** (distributed across the new hierarchical structure) - Legacy flat file approach in favor of organized package structure ### Fixed - None ### Security - None ### Breaking Changes - **No breaking changes** - All existing functionality and import patterns continue to work unchanged --- ### Additional Information - This is **part 3 of 4** in a comprehensive config.py refactoring series - **Architectural improvement**: Changed from planned flat structure to hierarchical organization during implementation - **100% backward compatibility maintained** - no existing code needs updates - See discussion: #17429 for the complete refactoring plan #### Improved File Structure The new hierarchical organization provides clear logical separation: ``` config/ ├── core/ # Fundamental system components │ ├── auth.py # Authentication & security │ ├── base.py # Core config classes │ ├── database.py # Database configuration │ └── logging.py # Logging setup ├── features/ # Application feature settings │ ├── admin.py # Administrative controls │ ├── features.py # Feature toggles │ ├── misc.py # General settings │ ├── permissions.py # Access control │ ├── static.py # Static file serving │ ├── tasks.py # Background tasks │ └── ui.py # User interface └── integrations/ # External service configs ├── code_interpreter.py # Code execution ├── llm.py # LLM providers ├── media.py # Image/audio generation ├── retrieval.py # RAG and documents ├── storage.py # File storage └── vector.py # Vector databases ``` ### Screenshots or Videos - [Attach any relevant screenshots or videos demonstrating the changes] ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-15 21:38:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#95467