From 0b54b765df66421c603e8d5c8bf37c2cfe173250 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Wed, 25 Feb 2026 00:19:52 -0800 Subject: [PATCH] fix: fetch all SMTP config (host, user, password) from claude-ops The rSwag Infisical project has stale SMTP values that can't be updated (admin identity not a project member). Fetch authoritative SMTP_HOST, SMTP_USER, and SMTP_PASSWORD from claude-ops /mail folder which overrides stale values from both .env and rSwag Infisical project. Co-Authored-By: Claude Opus 4.6 --- backend/entrypoint.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/entrypoint.sh b/backend/entrypoint.sh index 660526b..983dda3 100755 --- a/backend/entrypoint.sh +++ b/backend/entrypoint.sh @@ -62,9 +62,8 @@ else echo "[infisical] Starting with existing env vars" fi -# Fetch SMTP password from claude-ops /mail if not already set -if [ -z "$SMTP_PASSWORD" ]; then - SMTP_PWD=$(python3 -c " +# Fetch SMTP config from claude-ops /mail (authoritative source for rSwag email) +SMTP_OVERRIDES=$(python3 -c " import urllib.request, json, os, sys base = os.environ.get('INFISICAL_URL', 'http://infisical:8080') try: @@ -74,17 +73,18 @@ try: req = urllib.request.Request(f'{base}/api/v3/secrets/raw?workspaceSlug=claude-ops&environment=prod&secretPath=/mail') req.add_header('Authorization', f'Bearer {token}') secrets = json.loads(urllib.request.urlopen(req).read()) + mapping = {'RSWAG_SMTP_HOST': 'SMTP_HOST', 'RSWAG_SMTP_USER': 'SMTP_USER', 'RSWAG_SMTP_PASSWORD': 'SMTP_PASSWORD'} for s in secrets.get('secrets',[]): - if s['secretKey'] == 'RSWAG_SMTP_PASSWORD': - print(s['secretValue']) - break + env_key = mapping.get(s['secretKey']) + if env_key: + val = s['secretValue'].replace(\"'\", \"'\\\\'\") + print(f\"export {env_key}='{val}'\") except Exception as e: - print(f'[smtp] Could not fetch password: {e}', file=sys.stderr) + print(f'[smtp] Could not fetch from claude-ops: {e}', file=sys.stderr) " 2>&1) || true - if [ -n "$SMTP_PWD" ] && echo "$SMTP_PWD" | grep -qv '^\['; then - export SMTP_PASSWORD="$SMTP_PWD" - echo "[infisical] Fetched SMTP password from claude-ops/mail" - fi +if echo "$SMTP_OVERRIDES" | grep -q "^export "; then + eval "$SMTP_OVERRIDES" + echo "[infisical] Loaded SMTP config from claude-ops/mail" fi exec "$@"