mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 16:54:23 +01:00
distinguish empty output from invalid JSON in reserve share handler
This commit is contained in:
parent
d3147d6ed9
commit
7af61a1959
@ -147,11 +147,14 @@ if [[ "${ZROK_FRONTEND_MODE:-}" == temp-public ]]; then
|
|||||||
exec zrok ${ZROK_CMD}
|
exec zrok ${ZROK_CMD}
|
||||||
else
|
else
|
||||||
# reserve and continue
|
# reserve and continue
|
||||||
zrok ${ZROK_CMD} | jq -rc | tee ~/.zrok/reserved.json
|
zrok ${ZROK_CMD} > ~/.zrok/reserved.json
|
||||||
# share the reserved backend target until exit
|
# share the reserved backend target until exit
|
||||||
if ! [[ -s ~/.zrok/reserved.json ]]; then
|
if ! [[ -s ~/.zrok/reserved.json ]]; then
|
||||||
echo "ERROR: empty or missing $(realpath ~/.zrok)/reserved.json" >&2
|
echo "ERROR: empty or missing $(realpath ~/.zrok)/reserved.json" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
elif ! jq . < ~/.zrok/reserved.json &>/dev/null; then
|
||||||
|
echo "ERROR: invalid JSON in $(realpath ~/.zrok)/reserved.json" >&2
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
ZROK_PUBLIC_URLS=$(jq -cr '.frontend_endpoints' ~/.zrok/reserved.json 2>/dev/null)
|
ZROK_PUBLIC_URLS=$(jq -cr '.frontend_endpoints' ~/.zrok/reserved.json 2>/dev/null)
|
||||||
if [[ -z "${ZROK_PUBLIC_URLS}" || "${ZROK_PUBLIC_URLS}" == null ]]; then
|
if [[ -z "${ZROK_PUBLIC_URLS}" || "${ZROK_PUBLIC_URLS}" == null ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user