File size: 1,374 Bytes
daaa6ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30117ef
 
72688d6
30117ef
 
 
 
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
"""

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

# ── Paths ──────────────────────────────────────
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)

# ── Validation ─────────────────────────────────
ZONE_NAME_PATTERN = re.compile(r"^[a-zA-Z0-9_-]{1,50}$")

# ── Port Limits ────────────────────────────────
MIN_PORT = 1024
MAX_PORT = 65535

# ── Terminal ───────────────────────────────────
SCROLLBACK_SIZE = 128 * 1024  # 128 KB

# ── Admin API (Cloudflare Worker) ──────────────
ADMIN_API_URL = "https://hugpanel-admin.lab70018.workers.dev"

# ── Backup (local temp dir) ────────────────────
BACKUP_DIR = DATA_DIR.parent / "backups"
BACKUP_DIR.mkdir(parents=True, exist_ok=True)