22 lines
689 B
Python
22 lines
689 B
Python
import os
|
|
|
|
|
|
def get_cloud_url() -> str:
|
|
return os.environ.get("ORDERPY_CLOUD_URL", "http://localhost:8001").rstrip("/").replace("http://", "ws://").replace("https://", "wss://")
|
|
|
|
|
|
def get_printer_health_interval() -> int:
|
|
"""Seconds between printer health checks. Default 10."""
|
|
try:
|
|
return max(5, int(os.environ.get("ORDERPY_PRINTER_HEALTH_INTERVAL", "10")))
|
|
except ValueError:
|
|
return 10
|
|
|
|
|
|
def get_allowed_origins() -> list[str]:
|
|
raw = os.environ.get(
|
|
"ORDERPY_ALLOWED_ORIGINS",
|
|
"http://localhost:3000,http://127.0.0.1:3000,http://localhost:5173,http://127.0.0.1:5173",
|
|
)
|
|
return [o.strip() for o in raw.split(",") if o.strip()]
|