Restore per-leader routing with configurable email addresses

Previously routing was hardcoded (Andrea for indoor, Barbara for outdoor).
Then it was replaced with a flat ADMIN_EMAILS list which lost the routing.
This commit restores routing via three separate env vars:

  ADMIN_EMAIL_INDOOR  — indoor leader, To when indoor days are booked
  ADMIN_EMAIL_OUTDOOR — outdoor leader, To when outdoor days are booked
  ADMIN_EMAIL_CC      — always Cc'd (comma-separated for multiple)

For testing, set all three to your own address so no real leader gets mail.

Changes:
- Config: replaced admin_emails with admin_email_indoor/outdoor/cc fields
- AdminNotifier: replaced admin_emails param with indoor_email/outdoor_email/
  cc_emails; _recipients_for() restored as an instance method using these
- main.py: wires the three new config fields into AdminNotifier
- .env.example: documents the three new variables with production defaults
- Tests: fixture updated to use new params

https://claude.ai/code/session_01HaUFs7SaLD5SoiuGCY27Tw
This commit is contained in:
Claude
2026-02-21 21:31:49 +00:00
parent 7fb1d1fa0f
commit db97a357c9
5 changed files with 59 additions and 28 deletions
+7 -6
View File
@@ -44,13 +44,14 @@ SMTP_USE_TLS=true
REGISTRATION_EMAIL=anmeldung@example.com
# ---------------------------------------------------------------
# Admin notification recipients (comma-separated)
# First address → To; remaining addresses → Cc.
# For testing, set this to just your own email address.
# Production example (indoor leader, outdoor leader, admin):
# ADMIN_EMAILS=andrea.sigrist@gmx.net,baba.laeubli@gmail.com,spielgruppen@familien-verein.ch
# Admin notification routing
# Each leader receives mail only when a day in their group is booked.
# ADMIN_EMAIL_CC is always included as Cc (comma-separated for multiple).
# For testing, point all three to your own email address.
# ---------------------------------------------------------------
ADMIN_EMAILS=you@example.com
ADMIN_EMAIL_INDOOR=andrea.sigrist@gmx.net
ADMIN_EMAIL_OUTDOOR=baba.laeubli@gmail.com
ADMIN_EMAIL_CC=spielgruppen@familien-verein.ch
# ---------------------------------------------------------------
# Storage