-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathconfig.py
More file actions
58 lines (42 loc) · 2.16 KB
/
config.py
File metadata and controls
58 lines (42 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""Application settings loaded from environment variables."""
from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
# Root data directory lives next to the *package* directory so that the
# location is the same regardless of the caller's working directory.
_PACKAGE_DIR = Path(__file__).resolve().parent
_DEFAULT_DATA_DIR = str(_PACKAGE_DIR.parent / "data")
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_prefix="TERMINALS_", env_file=".env")
api_key: str = ""
open_webui_url: str = "" # if set, validate JWTs against this Open WebUI instance
# Database
database_url: str = f"sqlite+aiosqlite:///{_DEFAULT_DATA_DIR}/terminals.db"
# Backend selection: "docker", "kubernetes", or "kubernetes-operator"
backend: str = "docker"
# Docker settings
image: str = "ghcr.io/open-webui/open-terminal:latest"
network: str = ""
docker_host: str = "127.0.0.1" # address to reach published container ports
data_dir: str = f"{_DEFAULT_DATA_DIR}/terminals"
port: int = 3000
host: str = "0.0.0.0"
# Kubernetes settings
kubernetes_namespace: str = "terminals"
kubernetes_image: str = "ghcr.io/open-webui/open-terminal:latest"
kubernetes_storage_class: str = "" # empty = cluster default
kubernetes_storage_size: str = "1Gi"
kubernetes_storage_mode: str = "per-user" # per-user, shared, shared-rwo
kubernetes_service_type: str = "ClusterIP"
kubernetes_kubeconfig: str = "" # empty = in-cluster config
kubernetes_labels: str = "" # extra labels as "k=v,k2=v2"
# Operator-specific settings
kubernetes_crd_group: str = "openwebui.com"
kubernetes_crd_version: str = "v1alpha1"
# Idle reaper — tear down terminals after N minutes of inactivity (0 = disabled)
idle_timeout_minutes: int = 0
# Policy hard caps (cannot be exceeded by API)
max_cpu: str = "" # TERMINALS_MAX_CPU
max_memory: str = "" # TERMINALS_MAX_MEMORY
max_storage: str = "" # TERMINALS_MAX_STORAGE
allowed_images: str = "" # TERMINALS_ALLOWED_IMAGES (comma-separated globs)
settings = Settings()