From 28d4c985ce05d2210adc3093bdb8d74dec42cd29 Mon Sep 17 00:00:00 2001 From: Mads Jon Nielsen Date: Wed, 9 Sep 2026 08:53:50 +0200 Subject: [PATCH] Run shellcheck with every optional check at style severity and fix what it flags --- .github/workflows/qa.yml | 3 +++ firecow_cloudflared | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 5bf6728..67eff28 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -24,7 +24,10 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: ShellCheck uses: ludeeus/action-shellcheck@2.0.0 + env: + SHELLCHECK_OPTS: --enable=all with: + severity: style additional_files: 'firecow_cloudflared' build: diff --git a/firecow_cloudflared b/firecow_cloudflared index 704ef5f..c0b8a5c 100755 --- a/firecow_cloudflared +++ b/firecow_cloudflared @@ -4,15 +4,15 @@ set -e # function that prints info message, if TUNNEL_LOGLEVEL is debug or info printInfo() { - echo "${TUNNEL_LOGLEVEL}" | grep -q -E '^(debug|info)$' || return 0 + echo "${TUNNEL_LOGLEVEL-}" | grep -q -E '^(debug|info)$' || return 0 formattedDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ') - echo "$formattedDate INF ${1}" + echo "${formattedDate} INF ${1}" } # function that prints fatal message and exits printAndExit() { formattedDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ') - echo >&2 "$formattedDate FAT ${2}" + echo >&2 "${formattedDate} FAT ${2}" exit "${1}" } @@ -66,7 +66,7 @@ cat << EOF > /etc/cloudflared/config.yml tunnel: ${tunnel_id} credentials-file: /etc/cloudflared/${tunnel_id}.json ingress: - - service: ${TUNNEL_URL:-$TUNNEL_UNIX_SOCKET} + - service: ${TUNNEL_URL:-${TUNNEL_UNIX_SOCKET}} EOF unset TUNNEL_URL