From bd1fdd5b5aefbf236e3323ab42332a51287892de Mon Sep 17 00:00:00 2001 From: Maximilian Moser <maximilian.moser@tuwien.ac.at> Date: Thu, 27 Jul 2023 15:29:32 +0200 Subject: [PATCH] Add option to disable SSL verification on check-records.sh * this is useful for local/development instances that have self-signed certificates and thus wouldn't pass the SSL check --- health/check-records.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/health/check-records.sh b/health/check-records.sh index ec09f6e..c737a03 100755 --- a/health/check-records.sh +++ b/health/check-records.sh @@ -5,7 +5,42 @@ # # requires `curl` and `jq` to be installed +set -eu + base_url="${BASE_URL:-https://test.researchdata.tuwien.ac.at}" +check_ssl=1 + +function usage() { + echo "usage: $0 [-k] [ BASE_URL ]" + echo + echo " -k Disable SSL verification" +} + +function curl() { + if [[ "${check_ssl}" -gt 0 ]]; then + command curl "$@" + else + command curl -k "$@" + fi +} + +# parse arguments +while getopts "hk" opt; do + case "${opt}" in + h) + usage + exit 0 + ;; + k) + check_ssl=0 + ;; + *) + usage >&2 + exit 1 + ;; + esac +done +shift $(( OPTIND - 1 )) if [[ $# -gt 0 ]]; then base_url="$1" -- GitLab