mirror of
git://f0xx.org/ac/ac-deploy
synced 2026-07-29 05:19:12 +03:00
cluster0: auth-email bearer + shorten verify URLs in outbound mail
ShortLinksRepository::shortenForOutbound; ensure-auth-email-bearer.sh; verify-mail-lab sends shortened s.f0xx.org link in verify email body. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
24
sim/cluster0/scripts/ensure-auth-email-bearer.sh
Executable file
24
sim/cluster0/scripts/ensure-auth-email-bearer.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
# Mint auth-email bearer for outbound mail short links; store id in secrets + config.
|
||||
set -eu
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
. "$ROOT/scripts/lib/common.sh"
|
||||
load_cluster_env
|
||||
|
||||
COMPOSED="${COMPOSE_BACKEND:-/var/www/ac/composed/backend}"
|
||||
SCRIPT="${COMPOSED}/scripts/ensure_auth_email_bearer.php"
|
||||
[ -f "$SCRIPT" ] || SCRIPT="${ROOT}/lab-seeds/backend/scripts/ensure_auth_email_bearer.php"
|
||||
[ -f "$SCRIPT" ] || die "ensure_auth_email_bearer.php missing"
|
||||
|
||||
BEARER_ID="$(php83 "$SCRIPT" 2>/dev/null | tail -1)"
|
||||
[ -n "$BEARER_ID" ] && [ "$BEARER_ID" -gt 0 ] 2>/dev/null || die "could not mint auth-email bearer"
|
||||
|
||||
SECRETS="${CAST_CLUSTER_ROOT}/secrets.lab.env"
|
||||
if [ -f "$SECRETS" ]; then
|
||||
grep -v '^URL_SHORTENER_AUTH_BEARER_ID=' "$SECRETS" > /tmp/secrets.new || true
|
||||
echo "URL_SHORTENER_AUTH_BEARER_ID=${BEARER_ID}" >> /tmp/secrets.new
|
||||
mv /tmp/secrets.new "$SECRETS"
|
||||
chmod 600 "$SECRETS"
|
||||
fi
|
||||
log "ensure-auth-email-bearer_ok id=${BEARER_ID}"
|
||||
Reference in New Issue
Block a user