fix: filter eval to only export lines in Infisical entrypoint
The 2>&1 redirect captured stderr log messages into EXPORTS variable, causing eval to fail on "[infisical] ..." lines. Now only lines starting with "export" are eval'd. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
94fd3ad4d3
commit
fb5199c094
|
|
@ -48,14 +48,16 @@ try:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'[infisical] Error: {e}', file=sys.stderr)
|
print(f'[infisical] Error: {e}', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
" 2>&1) || {
|
") || {
|
||||||
echo "[infisical] WARNING: Failed to fetch secrets, starting with existing env vars"
|
echo "[infisical] WARNING: Failed to fetch secrets, starting with existing env vars"
|
||||||
exec "$@"
|
exec "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
if echo "$EXPORTS" | grep -q "^export "; then
|
if echo "$EXPORTS" | grep -q "^export "; then
|
||||||
COUNT=$(echo "$EXPORTS" | grep -c "^export ")
|
# Only eval lines starting with "export" — skip any log messages
|
||||||
eval "$EXPORTS"
|
EXPORT_LINES=$(echo "$EXPORTS" | grep "^export ")
|
||||||
|
COUNT=$(echo "$EXPORT_LINES" | wc -l)
|
||||||
|
eval "$EXPORT_LINES"
|
||||||
echo "[infisical] Injected ${COUNT} secrets"
|
echo "[infisical] Injected ${COUNT} secrets"
|
||||||
else
|
else
|
||||||
echo "[infisical] WARNING: $EXPORTS"
|
echo "[infisical] WARNING: $EXPORTS"
|
||||||
|
|
@ -81,9 +83,10 @@ try:
|
||||||
print(f\"export {env_key}='{val}'\")
|
print(f\"export {env_key}='{val}'\")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'[smtp] Could not fetch from claude-ops: {e}', file=sys.stderr)
|
print(f'[smtp] Could not fetch from claude-ops: {e}', file=sys.stderr)
|
||||||
" 2>&1) || true
|
") || true
|
||||||
if echo "$SMTP_OVERRIDES" | grep -q "^export "; then
|
if echo "$SMTP_OVERRIDES" | grep -q "^export "; then
|
||||||
eval "$SMTP_OVERRIDES"
|
SMTP_EXPORT_LINES=$(echo "$SMTP_OVERRIDES" | grep "^export ")
|
||||||
|
eval "$SMTP_EXPORT_LINES"
|
||||||
echo "[infisical] Loaded SMTP config from claude-ops/mail"
|
echo "[infisical] Loaded SMTP config from claude-ops/mail"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue