Introduce typed config objects, optional adapter injection, and .env loading to simplify testing while preserving env-based defaults for production usage. Co-authored-by: Cursor <[email protected]>
15 lines
397 B
Python
15 lines
397 B
Python
"""Load environment variables from a .env file."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from dotenv import load_dotenv as _load_dotenv
|
|
|
|
|
|
def load_dotenv(path: str | Path | None = None) -> bool:
|
|
"""Load .env into os.environ. Idempotent; returns True if a file was loaded."""
|
|
if path is None:
|
|
return bool(_load_dotenv())
|
|
return bool(_load_dotenv(path))
|