Buckets:

download
raw
1.02 kB
import os
from pathlib import Path
from dotenv import load_dotenv
def _load_env_from_project_root() -> None:
"""
Find .env file by walking up the directory tree
starting from current file location.
"""
current = Path(__file__).resolve()
for parent in [current] + list(current.parents):
env_file = parent / ".env"
if env_file.exists():
# override=True: .env overrides existing env vars (avoid /data from Docker when running dev)
load_dotenv(dotenv_path=env_file, override=True)
return
# Do not raise here – let fail-fast happen in get_env()
# This makes debugging clearer
# Load .env on module import
_load_env_from_project_root()
def get_env(key: str, default: str | None = None) -> str:
value = os.getenv(key, default)
if value is None:
raise RuntimeError(f"Missing required environment variable: {key}")
return value
def get_path(key: str) -> Path:
return Path(get_env(key)).expanduser().resolve()

Xet Storage Details

Size:
1.02 kB
·
Xet hash:
c68baa5d32ec9bc346dc4d988da594d0acc10141c4502acc893b055af067771a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.