Make admin notification recipients configurable via ADMIN_EMAILS
Previously the To/Cc addresses were hardcoded in notifier.py (Andrea, Barbara, Markus). This caused accidental emails to production contacts during testing. Changes: - New ADMIN_EMAILS env var: comma-separated list of addresses. First address → To; remaining addresses → Cc. - AdminNotifier now accepts admin_emails list; warns and skips if empty. - Removed hardcoded _INDOOR_EMAIL / _OUTDOOR_EMAIL / _ADMIN_CC_EMAIL constants and the _recipients_for() routing method. - Config.from_env() parses ADMIN_EMAILS into a list. - main.py passes config.admin_emails to AdminNotifier. - .env.example documents the new variable with production example. - Tests: fixture updated; TestRecipientsFor removed (routing gone). For testing: ADMIN_EMAILS=you@example.com For production: ADMIN_EMAILS=andrea.sigrist@gmx.net,baba.laeubli@gmail.com,spielgruppen@familien-verein.ch https://claude.ai/code/session_01HaUFs7SaLD5SoiuGCY27Tw
This commit is contained in:
@@ -32,6 +32,11 @@ class Config:
|
||||
# Registration email address shown to parents
|
||||
registration_email: str = ""
|
||||
|
||||
# Admin notification recipients (comma-separated).
|
||||
# First address → To; remaining addresses → Cc.
|
||||
# Set to a single address (e.g. your own) during testing.
|
||||
admin_emails: list = field(default_factory=list)
|
||||
|
||||
# Storage
|
||||
data_dir: Path = field(default_factory=lambda: Path("data"))
|
||||
knowledge_base_dir: Path = field(
|
||||
@@ -56,6 +61,11 @@ class Config:
|
||||
smtp_port=int(os.getenv("SMTP_PORT", "587")),
|
||||
smtp_use_tls=os.getenv("SMTP_USE_TLS", "true").lower() == "true",
|
||||
registration_email=os.getenv("REGISTRATION_EMAIL", ""),
|
||||
admin_emails=[
|
||||
e.strip()
|
||||
for e in os.getenv("ADMIN_EMAILS", "").split(",")
|
||||
if e.strip()
|
||||
],
|
||||
data_dir=Path(os.getenv("DATA_DIR", "data")),
|
||||
knowledge_base_dir=Path(
|
||||
os.getenv(
|
||||
|
||||
Reference in New Issue
Block a user