Skip to content

Commit 2620222

Browse files
committed
refactor: rename OPENWEBUI_API_URL to OPENWEBUI_BASE_URL
1 parent 5006237 commit 2620222

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ MODEL_CACHE_TTL=3600
6464
# This ensures images are accessible from anywhere (internal/external).
6565

6666
# Open WebUI instance URL (e.g., https://chat.mydomain.com)
67-
OPENWEBUI_API_URL=
67+
OPENWEBUI_BASE_URL=
6868

6969
# API key from Open WebUI (Settings > Account > API Keys)
7070
OPENWEBUI_API_KEY=

CONFIGURATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ Complete configuration reference for the Image Generation API.
5858

5959
### Open WebUI Integration
6060

61-
**`OPENWEBUI_API_URL`**
61+
**`OPENWEBUI_BASE_URL`**
6262
- Open WebUI instance URL
6363
- Example: `https://chat.mydomain.com`
6464
- When set (with API key), images are uploaded to Open WebUI's file storage
6565

6666
**`OPENWEBUI_API_KEY`**
6767
- API key from Open WebUI
6868
- Get from: Open WebUI Settings > Account > API Keys
69-
- Required together with `OPENWEBUI_API_URL`
69+
- Required together with `OPENWEBUI_BASE_URL`
7070

7171
When both are configured, images are automatically uploaded to Open WebUI. This ensures images work from anywhere - no more URL accessibility issues with Docker or external access.
7272

app/core/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Settings(BaseSettings):
5454
DEFAULT_MODEL: str | None = None # Default model for image generation
5555

5656
# Open WebUI Integration (optional)
57-
OPENWEBUI_API_URL: str | None = None # e.g. https://chat.mydomain.com
57+
OPENWEBUI_BASE_URL: str | None = None # e.g. https://chat.mydomain.com
5858
OPENWEBUI_API_KEY: str | None = None # API key from Open WebUI settings
5959

6060
# Server Configuration
@@ -79,7 +79,7 @@ def gemini_available(self) -> bool:
7979
@property
8080
def openwebui_available(self) -> bool:
8181
"""Check if Open WebUI integration is configured."""
82-
return bool(self.OPENWEBUI_API_URL and self.OPENWEBUI_API_KEY)
82+
return bool(self.OPENWEBUI_BASE_URL and self.OPENWEBUI_API_KEY)
8383

8484

8585
settings = Settings()

app/services/openwebui_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class OpenWebUIService:
1616
"""
1717

1818
def __init__(self):
19-
if not settings.OPENWEBUI_API_URL:
20-
raise ValueError("OPENWEBUI_API_URL not configured")
19+
if not settings.OPENWEBUI_BASE_URL:
20+
raise ValueError("OPENWEBUI_BASE_URL not configured")
2121
if not settings.OPENWEBUI_API_KEY:
2222
raise ValueError("OPENWEBUI_API_KEY not configured")
2323

24-
self.base_url = settings.OPENWEBUI_API_URL.rstrip("/")
24+
self.base_url = settings.OPENWEBUI_BASE_URL.rstrip("/")
2525
self.api_key = settings.OPENWEBUI_API_KEY
2626

2727
async def upload_image(self, image_data: bytes, filename: str) -> str:

tests/test_openwebui.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ def test_openwebui_available_property():
88
from app.core.config import Settings
99

1010
# Not available when URL missing
11-
settings = Settings(OPENWEBUI_API_URL=None, OPENWEBUI_API_KEY="key")
11+
settings = Settings(OPENWEBUI_BASE_URL=None, OPENWEBUI_API_KEY="key")
1212
assert settings.openwebui_available is False
1313

1414
# Not available when key missing
15-
settings = Settings(OPENWEBUI_API_URL="http://localhost", OPENWEBUI_API_KEY=None)
15+
settings = Settings(OPENWEBUI_BASE_URL="http://localhost", OPENWEBUI_API_KEY=None)
1616
assert settings.openwebui_available is False
1717

1818
# Available when both set
1919
settings = Settings(
20-
OPENWEBUI_API_URL="http://localhost", OPENWEBUI_API_KEY="key"
20+
OPENWEBUI_BASE_URL="http://localhost", OPENWEBUI_API_KEY="key"
2121
)
2222
assert settings.openwebui_available is True
2323

@@ -28,7 +28,7 @@ async def test_openwebui_service_upload():
2828
from app.services.openwebui_service import OpenWebUIService
2929

3030
with patch("app.services.openwebui_service.settings") as mock_settings:
31-
mock_settings.OPENWEBUI_API_URL = "https://chat.example.com"
31+
mock_settings.OPENWEBUI_BASE_URL = "https://chat.example.com"
3232
mock_settings.OPENWEBUI_API_KEY = "test-key"
3333

3434
service = OpenWebUIService()
@@ -65,7 +65,7 @@ async def test_openwebui_service_upload_no_file_id():
6565
from app.services.openwebui_service import OpenWebUIService
6666

6767
with patch("app.services.openwebui_service.settings") as mock_settings:
68-
mock_settings.OPENWEBUI_API_URL = "https://chat.example.com"
68+
mock_settings.OPENWEBUI_BASE_URL = "https://chat.example.com"
6969
mock_settings.OPENWEBUI_API_KEY = "test-key"
7070

7171
service = OpenWebUIService()

0 commit comments

Comments
 (0)