Files
coreapp-dev/core/needs/email/teardown
T
davidandClaude Opus 5.5 6ab1db839b Add the email need: each app gets its own sending-only mail account
needs = ["email"] (coreapp new --email) makes an LDAP account
coreapp-<name> (not a person, no mailbox) and adds SMTP_* settings.
Teardown removes it only if it's the app's; the installer warns about
an entry it left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 15:01:11 -07:00

12 lines
635 B
Plaintext

# Delete its mail account from the Core's LDAP (only if it's this app's)
LDAP_BASE="$(sed -n 's/^LDAP_SEARCH_BASE=ou=people,//p' /federated/apps/mail/.env)"
LDAP_ADMIN_PW="$(cat /federated/apps/ldap/.ldap.secret)"
MAIL_DN="uid=coreapp-{{NAME}},ou=people,$LDAP_BASE"
if docker exec ldap ldapsearch -LLL -x -H ldap://localhost -D "cn=admin,$LDAP_BASE" \
-w "$LDAP_ADMIN_PW" -b "$MAIL_DN" -s base description 2>/dev/null \
| grep -qx "description: coreapps: {{NAME}}"; then
docker exec ldap ldapdelete -x -H ldap://localhost -D "cn=admin,$LDAP_BASE" \
-w "$LDAP_ADMIN_PW" "$MAIL_DN"
fi
unset LDAP_BASE LDAP_ADMIN_PW MAIL_DN