From ff8fa4b0967e29bf11ca2bf7c9587c1491a408e2 Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 8 Feb 2024 19:04:17 +0100 Subject: [PATCH] Fix healthcheck to exit on yagna socket issues too --- check_yagna.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/check_yagna.sh b/check_yagna.sh index aba2530..00881ba 100755 --- a/check_yagna.sh +++ b/check_yagna.sh @@ -1,2 +1,14 @@ -export KEY=$(yagna app-key list --json | jq -r '.values[0][1]') +#!/bin/sh +set -e # Exit immediately if a command exits with a non-zero status. +set -x # Print commands and their arguments as they are executed. + +# Get the Yagna app key +KEY=$(yagna app-key list --json | jq -r '.[0].key') + +if [ -z "$KEY" ]; then + echo "Key is empty, exiting." + exit 1 +fi + +# Use the key in the curl command curl -H "Authorization: Bearer ${KEY}" 127.0.0.1:7465/me