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>
This commit is contained in:
+9
-5
@@ -3,9 +3,9 @@
|
||||
# Purpose : Make, deploy and test apps for Federated Core, against the Core
|
||||
# in coreapp-dev's VM (coreapp-vm).
|
||||
#
|
||||
# coreapp new [--postgres] [--sso] <name>
|
||||
# coreapp new [--postgres] [--sso] [--email] <name>
|
||||
# make a new app in ./<name> (with its own database,
|
||||
# sign-in through the Core's Authelia, or both)
|
||||
# sign-in through the Core's Authelia, sending mail)
|
||||
# coreapp deploy [--recreate]
|
||||
# build, copy to the Core, install or update
|
||||
# (--recreate: a new container even if nothing changed)
|
||||
@@ -154,19 +154,20 @@ apply_overlay() {
|
||||
}
|
||||
|
||||
cmd_new() {
|
||||
local name="" postgres="" sso="" title dbname f needs="" what=""
|
||||
local name="" postgres="" sso="" email="" title dbname f needs="" what=""
|
||||
local overlays=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--postgres) postgres=1 ;;
|
||||
--sso) sso=1 ;;
|
||||
-*) die "Unknown option $1. Usage: coreapp new [--postgres] [--sso] <name>" ;;
|
||||
--email) email=1 ;;
|
||||
-*) die "Unknown option $1. Usage: coreapp new [--postgres] [--sso] [--email] <name>" ;;
|
||||
*) name="$1" ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
[[ -d "$TEMPLATE" ]] || die "The app template is missing: $TEMPLATE"
|
||||
[[ -n "$name" ]] || die "Usage: coreapp new [--postgres] [--sso] <name> (lowercase letters, digits and -)"
|
||||
[[ -n "$name" ]] || die "Usage: coreapp new [--postgres] [--sso] [--email] <name> (lowercase letters, digits and -)"
|
||||
[[ "$name" =~ ^[a-z]([a-z0-9-]{0,29}[a-z0-9])$ ]] \
|
||||
|| die "'$name': use 2-31 lowercase letters, digits and -, starting with a letter and not ending with -. It becomes https://$name.<domain>."
|
||||
[[ ! -e "$name" ]] || die "./$name already exists."
|
||||
@@ -189,6 +190,8 @@ cmd_new() {
|
||||
apply_overlay "$name" "$f"
|
||||
[[ -f "$f/.needs" ]] && needs="$needs, \"$(cat "$f/.needs")\""
|
||||
done
|
||||
# No example app for email: the settings are in README.md
|
||||
[[ -n "$email" ]] && needs="$needs, \"email\""
|
||||
sed -i "s/^needs = .*/needs = [${needs#, }]/" "$name/coreapp.toml"
|
||||
# The example apps with a database or sign-in have a /health path
|
||||
[[ ${#overlays[@]} -gt 0 ]] && sed -i 's|^health = .*|health = "/health"|' "$name/coreapp.toml"
|
||||
@@ -199,6 +202,7 @@ cmd_new() {
|
||||
|
||||
[[ -n "$postgres" ]] && what=", with a database"
|
||||
[[ -n "$sso" ]] && what="$what, with sign-in through Authelia"
|
||||
[[ -n "$email" ]] && what="$what, sending mail"
|
||||
echo "Made $title in ./$name$what."
|
||||
echo "Next: cd $name && coreapp deploy"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user