from fastapi import HTTPException import os def validate_token(token: str): """ Validate the provided token against the HF_TOKEN environment variable. Raises an HTTPException if validation fails. """ HF_TOKEN = os.getenv("VEUREU_TOKEN") if HF_TOKEN is None: raise RuntimeError("HF_TOKEN environment variable is not set on the server.") if token != HF_TOKEN: raise HTTPException(status_code=401, detail="Invalid token")