You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
930 B

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. #!/bin/bash
  2. set -e
  3. exec 3>&1 # make stdout available as fd 3 for the result
  4. exec 1>&2 # redirect all output to stderr for logging
  5. source $(dirname $0)/common.sh
  6. payload=$(mktemp $TMPDIR/concoure-curl-resource-request.XXXXXX)
  7. cat > $payload <&0
  8. url=$(jq -r '.source.url // ""' < $payload)
  9. username=$(jq -r '.source.username // ""' < $payload)
  10. password=$(jq -r '.source.password // ""' < $payload)
  11. skip_ssl_verification=$(jq -r '.source.skip_ssl_verification // ""' < $payload)
  12. if [ -z "$url" ]; then
  13. echo "invalid payload (missing url)"
  14. exit 1
  15. fi
  16. args_security=
  17. [ -n "$username" ] && args_security="-u $username";
  18. [ -n "$username" ] && [ -n "$password" ] && args_security="$args_security:$password";
  19. trueValue="true"
  20. [ -n "$skip_ssl_verification" ] && [ "${skip_ssl_verification,,}" = "${trueValue,,}" ] && args_security="$args_security -k";
  21. final_url=$(echo "$args_security" " $url")
  22. check_version "$final_url" >&3