feat: add environment variable configuration for server settings

Configurable via:
- UPSCALE_PORT (default: 7860)
- UPSCALE_HOST (default: 0.0.0.0)
- UPSCALE_SHARE (default: false)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-27 12:00:55 +01:00
parent a6d20cf087
commit bbea2c8513

View File

@@ -1,5 +1,6 @@
"""Configuration settings for Real-ESRGAN Web UI.""" """Configuration settings for Real-ESRGAN Web UI."""
import os
from dataclasses import dataclass, field from dataclasses import dataclass, field
from pathlib import Path from pathlib import Path
from typing import Optional from typing import Optional
@@ -162,10 +163,10 @@ VIDEO_CODECS: dict[str, VideoCodecConfig] = {
class AppConfig: class AppConfig:
"""Main application configuration.""" """Main application configuration."""
# Server settings # Server settings (configurable via environment variables)
server_name: str = "0.0.0.0" server_name: str = os.getenv("UPSCALE_HOST", "0.0.0.0")
server_port: int = 7860 server_port: int = int(os.getenv("UPSCALE_PORT", "7860"))
share: bool = False share: bool = os.getenv("UPSCALE_SHARE", "").lower() in ("true", "1", "yes")
# Queue settings # Queue settings
max_queue_size: int = 20 max_queue_size: int = 20