AkahuSync/config.py

20 lines
502 B
Python

from __future__ import annotations
from pathlib import Path
from dotenv import load_dotenv
REPO_ROOT = Path(__file__).resolve().parent
def load_env(service: str | None = None) -> None:
root_env = REPO_ROOT / ".env"
if root_env.exists():
load_dotenv(root_env)
if service:
service_env = REPO_ROOT / service / ".env"
if service_env.exists():
# Service-specific values should override repo defaults.
load_dotenv(service_env, override=True)