diff --git a/scripts/alert.js b/scripts/alert.js index 31ed036..642eb92 100755 --- a/scripts/alert.js +++ b/scripts/alert.js @@ -42,8 +42,14 @@ async function main() { if (!subject) { console.error('alert.js: no subject given'); process.exit(1); } const env = readEnv(ENV_FILE); - const to = env.REPORT_EMAIL; - if (!to) { console.error(`alert.js: no REPORT_EMAIL in ${ENV_FILE}`); process.exit(1); } + // ALERT_EMAIL is for things that are broken; REPORT_EMAIL is for the Sunday digest. They + // are separate because an alert that only reaches a shared inbox is easy to scroll past, + // and because the digest should not become a channel people learn to ignore. Comma + // separated, and it falls back to REPORT_EMAIL so a machine whose .env predates this + // still alerts somewhere rather than silently not at all. + const to = (env.ALERT_EMAIL || env.REPORT_EMAIL || '') + .split(',').map(a => a.trim()).filter(Boolean).join(', '); + if (!to) { console.error(`alert.js: no ALERT_EMAIL or REPORT_EMAIL in ${ENV_FILE}`); process.exit(1); } if (!env.SMTP_HOST || !env.SMTP_USER || !env.SMTP_PASS) { console.error(`alert.js: SMTP is not configured in ${ENV_FILE}`); process.exit(1); } diff --git a/server/.env.example b/server/.env.example index 721ad05..104a74b 100644 --- a/server/.env.example +++ b/server/.env.example @@ -18,6 +18,12 @@ ADMIN_PASSWORD=changeme # blank to send only the per-team emails. REPORT_EMAIL=you@example.com +# Where BREAKAGE is reported, comma separated. Kept separate from REPORT_EMAIL so a +# failure alert does not have to compete with the weekly digest for attention, and so +# it can reach a person rather than only a shared inbox. Falls back to REPORT_EMAIL. +# Used by scripts/alert.js, which backup-to-drive.sh calls on every failure path. +ALERT_EMAIL=you@example.com,team@example.com + # Cron schedule for the digest. Default: every Sunday at 3:00 PM. # Format: minute hour day-of-month month day-of-week REPORT_CRON=0 15 * * 0