Skip to content

Commit cc916cc

Browse files
fix: add retry to get_token
1 parent 657564d commit cc916cc

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

scripts/init.sh

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,13 @@
22

33
set -e
44

5-
function confirm {
6-
local message="$1"
7-
echo -e "$message Continue? [Y/n]"
8-
read confirm
9-
10-
if [ "$confirm" == "n" ] || [ "$confirm" == "N" ]; then
11-
echo "Aborting script..."
12-
exit 1
13-
elif [ -z "$confirm" ] || [ "$confirm" == "y" ] || [ "$confirm" == "Y" ]; then
14-
confirm="y"
15-
else
16-
echo "Invalid input. Aborting script..."
17-
exit 1
18-
fi
19-
}
20-
215
if ! command -v jq >/dev/null; then
226
echo "Error: jq is not installed. Please install jq to continue."
237
exit 1
248
fi
259

2610
function get_token {
27-
local token=$(curl -X POST -H "Content-Type: application/json" -d '{"email": "'"$ADMIN_EMAIL"'", "password": "'"$ADMIN_PASSWORD"'"}' $DIRECTUS_URL/auth/login | jq -r '.data.access_token')
11+
local token=$(curl --retry 5 -X POST -H "Content-Type: application/json" -d '{"email": "'"$ADMIN_EMAIL"'", "password": "'"$ADMIN_PASSWORD"'"}' $DIRECTUS_URL/auth/login | jq -r '.data.access_token')
2812
echo "$token"
2913
}
3014

0 commit comments

Comments
 (0)