Skip to content

Commit

Permalink
Merge pull request open-webui#3591 from michaelpoluektov/fix-banners-env
Browse files Browse the repository at this point in the history
fix: fix WEBUI_BANNERS environment variable not working
  • Loading branch information
tjbck authored Jul 2, 2024
2 parents f57a435 + 655238d commit 2c06177
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import pkgutil
import chromadb
from chromadb import Settings
from base64 import b64encode
from bs4 import BeautifulSoup
from typing import TypeVar, Generic, Union
from typing import TypeVar, Generic
from pydantic import BaseModel
from typing import Optional

Expand All @@ -19,7 +18,6 @@
import requests
import shutil

from secrets import token_bytes
from constants import ERROR_MESSAGES

####################################
Expand Down Expand Up @@ -768,12 +766,14 @@ class BannerModel(BaseModel):
dismissible: bool
timestamp: int

try:
banners = json.loads(os.environ.get("WEBUI_BANNERS", "[]"))
banners = [BannerModel(**banner) for banner in banners]
except Exception as e:
print(f"Error loading WEBUI_BANNERS: {e}")
banners = []

WEBUI_BANNERS = PersistentConfig(
"WEBUI_BANNERS",
"ui.banners",
[BannerModel(**banner) for banner in json.loads("[]")],
)
WEBUI_BANNERS = PersistentConfig("WEBUI_BANNERS", "ui.banners", banners)


SHOW_ADMIN_DETAILS = PersistentConfig(
Expand Down

0 comments on commit 2c06177

Please sign in to comment.