"""Runtime configuration. Values come from environment variables so the same
image can be redeployed with different admin/flag pairs."""

import os
from pathlib import Path

HERE = Path(__file__).resolve().parent

ADMIN_USERNAME = os.environ.get("ADMIN_USERNAME", "Marcel")
FLAG = os.environ.get("FLAG", "MCTF{redacted_local_dev}")

CATALOG_DIR = Path(os.environ.get("CATALOG_DIR", HERE / "catalog"))
WEIGHTS_DIR = Path(os.environ.get("WEIGHTS_DIR", HERE / "weights"))
UPLOAD_TMP_DIR = Path(os.environ.get("UPLOAD_TMP_DIR", "/tmp"))

ALLOWED_EXT = {".mp4", ".mov", ".webm"}
MAX_UPLOAD_BYTES = 30 * 1024 * 1024
MAX_DURATION_SEC = 6.0
MAX_LONGEST_SIDE = 480
EXTRACT_SIDE = 256
FRAME_SUBSAMPLE = 4
INFERENCE_TIMEOUT_SEC = 30
MAX_CONCURRENT_INFERENCES = 1

HAMMING_TOL_BITS = 12
