htmx/backend/config.py
2026-04-01 21:13:58 +02:00

32 lines
997 B
Python

import os
from pathlib import Path
# URL Potree - configurée via variable d'environnement POTREE_URL
# Pour le développement local : POTREE_URL=http://localhost:8090
# Pour la production : POTREE_URL=http://potree_server:8090
def load_potree_config():
"""Charge la configuration Potree depuis les variables d'environnement."""
return os.getenv(
"POTREE_URL", "http://localhost:8090"
).strip().rstrip("/")
def get_entwine_path():
"""Retourne le chemin de entwine ou None si non trouvé"""
path = os.getenv("ENTWINE_PATH")
if path:
return path.strip()
return None
BASE_DIR = Path(__file__).resolve().parent
DATA_DIR = BASE_DIR / "data"
UPLOADS_DIR = DATA_DIR / "uploads"
EPT_DIR = DATA_DIR / "ept" # était POTREE_DIR
UPLOADS_DIR.mkdir(parents=True, exist_ok=True)
EPT_DIR.mkdir(parents=True, exist_ok=True)
SUPPORTED_FORMATS = [".las", ".laz", ".ply", ".xyz", ".pts"]
POTREE_URL = load_potree_config()
ENTWINE_PATH = get_entwine_path()