← back to Commercialrealestate
scripts/run-email-alerts.sh
18 lines
#!/bin/bash
# CRCP email-alerts runner (invoked by launchd once approved).
# Sources .env for GEORGE_URL + GEORGE_EXTERNAL_SEND_TOKEN, then runs the
# snapshot-diff alert engine in SEND mode (which also advances seen-state).
# launchd runs with a minimal PATH that does NOT include Homebrew, so bare
# `node` / `/usr/bin/env node` fail with exit 127. Pin PATH so node resolves.
export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
set -a
[ -f "$HOME/Projects/commercialrealestate/.env" ] && . "$HOME/Projects/commercialrealestate/.env"
set +a
# George send path: token from its canonical home (george-gmail/.env), local :9850.
export GEORGE_URL="${GEORGE_URL:-http://127.0.0.1:9850}"
if [ -z "$GEORGE_EXTERNAL_SEND_TOKEN" ] && [ -f "$HOME/Projects/george-gmail/.env" ]; then
export GEORGE_EXTERNAL_SEND_TOKEN="$(grep -m1 '^GEORGE_EXTERNAL_SEND_TOKEN=' "$HOME/Projects/george-gmail/.env" | cut -d= -f2- | tr -d '"'\''')"
fi
cd "$HOME/Projects/commercialrealestate" || exit 1
/usr/bin/env node scripts/email-alerts.js --send