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
+3 -1
View File
@@ -58,7 +58,9 @@ def build_components(config: Config):
password=config.imap_password,
use_tls=config.smtp_use_tls,
from_email=config.registration_email,
admin_emails=config.admin_emails,
indoor_email=config.admin_email_indoor,
outdoor_email=config.admin_email_outdoor,
cc_emails=[e.strip() for e in config.admin_email_cc.split(",") if e.strip()],
)
agent = EmailAgent(model=config.ai_model, kb=kb, store=store, notifier=notifier)