[GH-ISSUE #7560] Configurations via Environment Variables not precedent over configs in the database #30320

Closed
opened 2026-04-25 04:34:06 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @justbert on GitHub (Dec 2, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7560

Bug Report

Installation Method

open-webui Helm chart via ArgoCD on OpenShift.

Environment

  • Open WebUI Version: v0.4.6

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

Configurations via environment variables should take precedence over state in database.

Actual Behavior:

Once a configuration has been set and stored in the database by interacting with the admin panel, they take priority from then on and cannot be configured via environment variables.

Description

Bug Summary:
When setting configurations via environment variables, persisted configurations in the database take precedence.

Generally, when it comes to configuring applications, environment variables take precedence over saved state at startup since these allow for managing an application programmatically. [https://12factor.net/config]

Reproduction Details

Steps to Reproduce:

  • Install and configure open-webui via container and environment variables
  • Interact with the admin panel and change a setting
  • Restart container

Logs and Screenshots

Docker Container Logs:

Fresh Install:

INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.

Interacted with admin panel:

INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
INFO [open_webui.env] 'ENABLE_OLLAMA_API' loaded from the latest database entry
INFO [open_webui.env] 'OLLAMA_BASE_URLS' loaded from the latest database entry
INFO [open_webui.env] 'OLLAMA_API_CONFIGS' loaded from the latest database entry
INFO [open_webui.env] 'ENABLE_OPENAI_API' loaded from the latest database entry
INFO [open_webui.env] 'OPENAI_API_KEYS' loaded from the latest database entry
INFO [open_webui.env] 'OPENAI_API_BASE_URLS' loaded from the latest database entry
INFO [open_webui.env] 'OPENAI_API_CONFIGS' loaded from the latest database entry
INFO [open_webui.env] 'DEFAULT_LOCALE' loaded from the latest database entry
INFO [open_webui.env] 'DEFAULT_PROMPT_SUGGESTIONS' loaded from the latest database entry

Originally created by @justbert on GitHub (Dec 2, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/7560 # Bug Report ## Installation Method open-webui Helm chart via ArgoCD on OpenShift. ## Environment - **Open WebUI Version:** v0.4.6 **Confirmation:** - [X] I have read and followed all the instructions provided in the README.md. - [ ] I am on the latest version of both Open WebUI and Ollama. - [ ] I have included the browser console logs. - [X] I have included the Docker container logs. - [X] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: Configurations via environment variables should take precedence over state in database. ## Actual Behavior: Once a configuration has been set and stored in the database by interacting with the admin panel, they take priority from then on and cannot be configured via environment variables. ## Description **Bug Summary:** When setting configurations via environment variables, persisted configurations in the database take precedence. Generally, when it comes to configuring applications, environment variables take precedence over saved state at startup since these allow for managing an application programmatically. [https://12factor.net/config] ## Reproduction Details **Steps to Reproduce:** - Install and configure open-webui via container and environment variables - Interact with the admin panel and change a setting - Restart container ## Logs and Screenshots **Docker Container Logs:** **Fresh Install:** INFO [alembic.runtime.migration] Context impl PostgresqlImpl. INFO [alembic.runtime.migration] Will assume transactional DDL. **Interacted with admin panel:** INFO [alembic.runtime.migration] Context impl PostgresqlImpl. INFO [alembic.runtime.migration] Will assume transactional DDL. INFO [open_webui.env] 'ENABLE_OLLAMA_API' loaded from the latest database entry INFO [open_webui.env] 'OLLAMA_BASE_URLS' loaded from the latest database entry INFO [open_webui.env] 'OLLAMA_API_CONFIGS' loaded from the latest database entry INFO [open_webui.env] 'ENABLE_OPENAI_API' loaded from the latest database entry INFO [open_webui.env] 'OPENAI_API_KEYS' loaded from the latest database entry INFO [open_webui.env] 'OPENAI_API_BASE_URLS' loaded from the latest database entry INFO [open_webui.env] 'OPENAI_API_CONFIGS' loaded from the latest database entry INFO [open_webui.env] 'DEFAULT_LOCALE' loaded from the latest database entry INFO [open_webui.env] 'DEFAULT_PROMPT_SUGGESTIONS' loaded from the latest database entry
Author
Owner

@tjbck commented on GitHub (Dec 2, 2024):

Intended behaviour here. env vars will only be used during initialization. However, I'd be open to accepting PRs for this!

<!-- gh-comment-id:2512430250 --> @tjbck commented on GitHub (Dec 2, 2024): Intended behaviour here. env vars will only be used during initialization. However, I'd be open to accepting PRs for this!
Author
Owner

@justbert commented on GitHub (Dec 2, 2024):

Ooof, gotcha. It doesn't follow general industry patterns and it doesn't seem to be well documented.

In the docs it states:

The following environment variables are used by backend/config.py to provide Open WebUI startup configuration. Please note that some variables may have different default values depending on whether you're running Open WebUI directly or via Docker.

It might be best to state that ...to provide Open WebUI with an initialization configuration

<!-- gh-comment-id:2512445472 --> @justbert commented on GitHub (Dec 2, 2024): Ooof, gotcha. It doesn't follow general industry patterns and it doesn't seem to be well documented. In the [docs](https://docs.openwebui.com/getting-started/advanced-topics/env-configuration#appbackend) it states: >The following environment variables are used by backend/config.py to provide Open WebUI startup configuration. Please note that some variables may have different default values depending on whether you're running Open WebUI directly or via Docker. It might be best to state that _**...to provide Open WebUI with an initialization configuration**_
Author
Owner

@tjbck commented on GitHub (Dec 2, 2024):

@justbert Agreed, there are some env vars that don't get saved to the database which might add to the confusion. I'm open to accepting PR for this (both the code, and the doc)!

<!-- gh-comment-id:2512470645 --> @tjbck commented on GitHub (Dec 2, 2024): @justbert Agreed, there are some env vars that don't get saved to the database which might add to the confusion. I'm open to accepting PR for this (both the code, and the doc)!
Author
Owner

@justbert commented on GitHub (Dec 2, 2024):

Sounds good! Just to clarify, in regards to a PR, would this be to update the docs or to re-align functionality to use set Env Vars as precedent?

<!-- gh-comment-id:2512501710 --> @justbert commented on GitHub (Dec 2, 2024): Sounds good! Just to clarify, in regards to a PR, would this be to update the docs or to re-align functionality to use set Env Vars as precedent?
Author
Owner

@justbert commented on GitHub (Dec 4, 2024):

Oh! I hadn't seen the RESET_CONFIG_ON_START env var. This should do nicely!

<!-- gh-comment-id:2517256851 --> @justbert commented on GitHub (Dec 4, 2024): Oh! I hadn't seen the `RESET_CONFIG_ON_START` env var. This should do nicely!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#30320