-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: video record standalone with GraphQL endpoint needs basic auth
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
- Loading branch information
Showing
4 changed files
with
36 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
endpoint=$1 | ||
graphql_endpoint=${2:-false} | ||
max_time=1 | ||
process_name="endpoint.checks" | ||
|
||
BASIC_AUTH="$(echo -n "${SE_ROUTER_USERNAME}:${SE_ROUTER_PASSWORD}" | base64)" | ||
|
||
if [ "${graphql_endpoint}" = "true" ]; then | ||
endpoint_checks=$(curl --noproxy "*" -m ${max_time} -k -X POST \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Basic ${BASIC_AUTH}" \ | ||
--data '{"query":"{ grid { sessionCount } }"}' \ | ||
-s "${endpoint}" -o /dev/null -w "%{http_code}") | ||
else | ||
endpoint_checks=$(curl --noproxy "*" -H "Authorization: Basic ${BASIC_AUTH}" -m ${max_time} -s -k -o /dev/null -w "%{http_code}" "${endpoint}") | ||
fi | ||
|
||
if [[ "$endpoint_checks" = "404" ]]; then | ||
echo "$(date +%FT%T%Z) [${process_name}] - Endpoint ${endpoint} is not found - status code: ${endpoint_checks}" | ||
elif [[ "$endpoint_checks" = "401" ]]; then | ||
echo "$(date +%FT%T%Z) [${process_name}] - Endpoint ${endpoint} requires authentication - status code: ${endpoint_checks}. Please provide valid credentials via SE_ROUTER_USERNAME and SE_ROUTER_PASSWORD environment variables." | ||
elif [[ "$endpoint_checks" != "200" ]]; then | ||
echo "$(date +%FT%T%Z) [${process_name}] - Endpoint ${endpoint} is not available - status code: ${endpoint_checks}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters