Fix some issues with local dev
This commit is contained in:
+19
-4
@@ -24,10 +24,25 @@ fi
|
||||
command -v infisical >/dev/null 2>&1 || { echo "export-env: Infisical CLI is required." >&2; exit 1; }
|
||||
"$ROOT_DIR/scripts/infisical-account" ensure
|
||||
|
||||
(cd "$ROOT_DIR" && infisical export --env="$INFISICAL_ENV" --format=dotenv --silent) || {
|
||||
echo "export-env: failed to export '$INFISICAL_ENV'; check login and project access." >&2
|
||||
exit 1
|
||||
}
|
||||
# Retry transient Infisical failures (e.g. 500s when several dev tasks fetch
|
||||
# concurrently at startup) so one flaky response doesn't kill the dev server.
|
||||
attempt=0
|
||||
while :; do
|
||||
attempt=$((attempt + 1))
|
||||
if EXPORT_OUT=$(cd "$ROOT_DIR" && infisical export --env="$INFISICAL_ENV" --format=dotenv --silent 2>"/tmp/export-env.$$.err"); then
|
||||
printf '%s\n' "$EXPORT_OUT"
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -ge 5 ]; then
|
||||
cat "/tmp/export-env.$$.err" >&2 2>/dev/null || true
|
||||
rm -f "/tmp/export-env.$$.err"
|
||||
echo "export-env: failed to export '$INFISICAL_ENV' after $attempt attempts; check login and project access." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "export-env: Infisical export failed (attempt $attempt/5), retrying in 2s..." >&2
|
||||
sleep 2
|
||||
done
|
||||
rm -f "/tmp/export-env.$$.err"
|
||||
|
||||
if [ -f "$STATE_FILE" ]; then
|
||||
printf '\n'
|
||||
|
||||
Reference in New Issue
Block a user