Skip to content

Commit 605beee

Browse files
committed
Fix push-secrets.sh to handle empty extra_args correctly. Updated the command to use ${extra_args[@]+"${extra_args[@]}"} to avoid issues with set -u when the array is empty, ensuring proper execution without errors.
1 parent 4caf2df commit 605beee

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/server/scripts/push-secrets.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ while IFS= read -r line || [[ -n "$line" ]]; do
5151
fi
5252

5353
echo "→ wrangler secret put $key"
54-
# stdin-fed value keeps it off the process table
55-
printf '%s' "$value" | npx --yes wrangler secret put "$key" "${extra_args[@]}" >/dev/null
54+
# stdin-fed value keeps it off the process table.
55+
# `${extra_args[@]+"${extra_args[@]}"}` expands the array only when set —
56+
# plain `"${extra_args[@]}"` tripping `set -u` with an empty array is
57+
# the exact bug this pattern avoids.
58+
printf '%s' "$value" | npx --yes wrangler secret put "$key" ${extra_args[@]+"${extra_args[@]}"} >/dev/null
5659
count=$((count + 1))
5760
done < .dev.vars
5861

0 commit comments

Comments
 (0)