mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-22 16:28:28 +02:00
moved _openssl helper a bit up to be near the other helper methods
This commit is contained in:
@@ -152,6 +152,22 @@ get_json_array() {
|
|||||||
grep -Eo '"'"${1}"'":[^\[]*\[[^]]*]'
|
grep -Eo '"'"${1}"'":[^\[]*\[[^]]*]'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# OpenSSL writes to stderr/stdout even when there are no errors. So just
|
||||||
|
# display the output if the exit code was != 0 to simplify debugging.
|
||||||
|
_openssl() {
|
||||||
|
set +e
|
||||||
|
out="$(openssl "${@}" 2>&1)"
|
||||||
|
res=$?
|
||||||
|
set -e
|
||||||
|
if [[ $res -ne 0 ]]; then
|
||||||
|
echo " + ERROR: failed to run $* (Exitcode: $res)" >&2
|
||||||
|
echo >&2
|
||||||
|
echo "Details:" >&2
|
||||||
|
echo "$out" >&2
|
||||||
|
exit $res
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
http_request() {
|
http_request() {
|
||||||
tempcont="$(mktemp)"
|
tempcont="$(mktemp)"
|
||||||
|
|
||||||
@@ -187,22 +203,6 @@ http_request() {
|
|||||||
rm -f "${tempcont}"
|
rm -f "${tempcont}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# OpenSSL writes to stderr/stdout even when there are no errors. So just
|
|
||||||
# display the output if the exit code was != 0 to simplify debugging.
|
|
||||||
_openssl() {
|
|
||||||
set +e
|
|
||||||
out="$(openssl "${@}" 2>&1)"
|
|
||||||
res=$?
|
|
||||||
set -e
|
|
||||||
if [[ $res -ne 0 ]]; then
|
|
||||||
echo " + ERROR: failed to run $* (Exitcode: $res)" >&2
|
|
||||||
echo >&2
|
|
||||||
echo "Details:" >&2
|
|
||||||
echo "$out" >&2
|
|
||||||
exit $res
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
signed_request() {
|
signed_request() {
|
||||||
# Encode payload as urlbase64
|
# Encode payload as urlbase64
|
||||||
payload64="$(printf '%s' "${2}" | urlbase64)"
|
payload64="$(printf '%s' "${2}" | urlbase64)"
|
||||||
|
|||||||
Reference in New Issue
Block a user