diff --git a/health/check-records.sh b/health/check-records.sh index ec09f6e05572aedda76803d0b90e798c9d80f34f..c737a036aa5ac016fed3270ed26cf9e4b728cdd9 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"