File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change 22
33set -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-
215if ! command -v jq > /dev/null; then
226 echo " Error: jq is not installed. Please install jq to continue."
237 exit 1
248fi
259
2610function 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 response=$( curl --fail --retry 5 -X POST -H " Content-Type: application/json" -d ' {"email": "' " $ADMIN_EMAIL " ' ", "password": "' " $ADMIN_PASSWORD " ' "}' $DIRECTUS_URL /auth/login)
12+ local token=$( echo " $response " | jq -r ' .data.access_token' )
2813 echo " $token "
2914}
3015
You can’t perform that action at this time.
0 commit comments