| """ |
| Centralized configuration for HugPanel. |
| |
| Single Responsibility: all constants and paths live here. |
| Dependency Inversion: other modules depend on this abstraction, not on each other. |
| """ |
|
|
| import os |
| import re |
| from pathlib import Path |
|
|
|
|
| def _clean_url(value: str) -> str: |
| return value.rstrip("/") if value else "" |
|
|
|
|
| |
| DATA_DIR = Path(os.environ.get("DATA_DIR", "/data/zones")) |
| ZONES_META = DATA_DIR.parent / "zones_meta.json" |
|
|
| DATA_DIR.mkdir(parents=True, exist_ok=True) |
|
|
| |
| ZONE_NAME_PATTERN = re.compile(r"^[a-zA-Z0-9_-]{1,50}$") |
|
|
| |
| MIN_PORT = 1024 |
| MAX_PORT = 65535 |
|
|
| |
| SCROLLBACK_SIZE = 128 * 1024 |
|
|
| |
| ADMIN_API_URL = _clean_url( |
| os.environ.get("ADMIN_API_URL", "https://hugpanel-admin.lab70018.workers.dev") |
| ) |
|
|
| |
| BACKUP_DIR = DATA_DIR.parent / "backups" |
| BACKUP_DIR.mkdir(parents=True, exist_ok=True) |
|
|