Use Sendico SMTP mailbox for local notifications (#57)
This commit is contained in:
1 parent
3e4e496037
commit
b36eb72c23
18 files changed
+528
-36
No files matched your search
@@ -61,7 +61,7 @@ provision_agents() {
|
||||
mkdir -p "$directory"; chmod 755 "$directory"
|
||||
case "$service" in
|
||||
bff) paths='services/bff/jwt';;
|
||||
notifications) paths='infrastructure/nats/auth services/notifications/email/resend';;
|
||||
notifications) paths='infrastructure/nats/auth services/notifications/email/smtp';;
|
||||
nats) paths=infrastructure/nats/auth;;
|
||||
sendico) paths=services/bff/sendico;;
|
||||
esac
|
||||
@@ -105,13 +105,12 @@ up() {
|
||||
random | jq -Rs --arg field "$field" '{($field):rtrimstr("\n")}' | put "$path"
|
||||
fi
|
||||
done
|
||||
printf '{"api_key":""}' | ensure services/notifications/email/resend
|
||||
provision_mongo
|
||||
provision_agents
|
||||
compose up -d --wait --wait-timeout 120 nats
|
||||
retire_secrets
|
||||
normalize_email_secret
|
||||
kv services/notifications/email/resend | email_valid || fail 'Vault kv/services/notifications/email/resend needs api_key. Run make email; configure the verified sender in infra/local/notifications/runtime.yml, then make build && make up.'
|
||||
kv services/notifications/email/smtp | smtp_valid || fail 'Vault kv/services/notifications/email/smtp needs the mailbox password. Run make email.'
|
||||
compose up -d --wait --wait-timeout 180
|
||||
export_ca
|
||||
cat <<'MESSAGE'
|
||||
@@ -134,7 +133,7 @@ MESSAGE
|
||||
}
|
||||
email() {
|
||||
existing
|
||||
printf 'Resend API key (hidden): ' >&2
|
||||
printf 'SMTP mailbox password (hidden): ' >&2
|
||||
tty_state=$(stty -g)
|
||||
trap 'stty "$tty_state"; cleanup' EXIT
|
||||
stty -echo
|
||||
@@ -143,7 +142,8 @@ email() {
|
||||
printf '\n' >&2
|
||||
[ -n "$key" ] || fail 'A key is required'
|
||||
printf '%s' "$key" > "$WORK/email-key"
|
||||
normalize_email_secret
|
||||
jq -n --rawfile key "$WORK/email-key" '{api_key:$key}' | put services/notifications/email/resend
|
||||
echo 'API key saved in Vault. Set the verified sender in infra/local/notifications/runtime.yml, then make build && make up.'
|
||||
jq -n --rawfile password "$WORK/email-key" '{password:$password}' > "$WORK/smtp-secret"
|
||||
smtp_valid < "$WORK/smtp-secret" || fail 'Invalid SMTP mailbox password'
|
||||
put services/notifications/email/smtp < "$WORK/smtp-secret"
|
||||
echo 'SMTP password saved in Vault. The notifications Agent reloads it automatically.'
|
||||
}
|
||||
Reference in new issue
Block a user