Compare commits

...

2 Commits

Author SHA1 Message Date
Alexander Tomokhov cd6d21b5f3 get API_TOKEN from environment variable 2023-12-12 09:07:12 +04:00
Alexander Tomokhov 57c6b9606e small fixes 2023-12-12 08:50:20 +04:00
1 changed files with 7 additions and 5 deletions

View File

@ -1,12 +1,12 @@
#! /usr/bin/env bash
set -o pipefail
set -o errexit
set -o nounset
set -o pipefail
shopt -s inherit_errexit
: ${DOMAIN:?specify domain name}
readonly AUTH_HEADER="Authorization: Bearer du-dummy-api-token"
: "${DOMAIN:?specify domain name}"
readonly AUTH_HEADER="Authorization: Bearer ${API_TOKEN:?not set error}"
readonly QUERY='query AllServices {
services {
allServices {
@ -85,9 +85,11 @@ received_response="$(curl --show-error -s "https://api.$DOMAIN/graphql" \
jq <<<"$received_response"
if [ "$EXPECTED_RESPONSE" == "$received_response" ]; then
if diff -w -u --color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s\n" "$received_response") 2>/dev/null
then
echo -e "\e[1;32mOK"
else
echo -e "\e[1;31mFAIL: response does not match!"
jd -color <(printf "%s" "$EXPECTED_RESPONSE") <(printf "%s" "$received_response")
exit 1
fi