From eb587978c5fed7b628631273a9207178c565f166 Mon Sep 17 00:00:00 2001 From: transcaffeine Date: Tue, 25 Mar 2025 17:51:13 +0100 Subject: [PATCH] fix(lego): ensure variables are either defined or have null-check handling --- roles/lego/files/lego_run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/lego/files/lego_run.sh b/roles/lego/files/lego_run.sh index fae68ee..2bbb81f 100644 --- a/roles/lego/files/lego_run.sh +++ b/roles/lego/files/lego_run.sh @@ -3,7 +3,7 @@ set -euo pipefail LEGO_BINARY=$(/usr/bin/env which lego) -if [[ -n "$LEGO_HTTP_FALLBACK_PORT" ]]; then +if [[ -n "${LEGO_HTTP_FALLBACK_PORT:-}" ]]; then if ! nc_binary="$(type -p \"nc\")" || [[ -z $nc_binary ]]; then echo "nc not found (in PATH), exiting" exit 1 @@ -14,7 +14,7 @@ if [[ -n "$LEGO_HTTP_FALLBACK_PORT" ]]; then fi fi -if [[ -n "$LEGO_PRE_RENEWAL_HOOK" ]]; then +if [[ -n "${LEGO_PRE_RENEWAL_HOOK:-}" ]]; then $LEGO_PRE_RENEWAL_HOOK fi @@ -30,6 +30,6 @@ fi find "$LEGO_CERT_STORE_PATH/certificates" -type f | xargs -I{} -n 1 chmod "$LEGO_CERT_MODE" "{}" find "$LEGO_CERT_STORE_PATH/certificates" -type f | xargs -I{} -n 1 chown "${LEGO_CERT_USER}:${LEGO_CERT_GROUP}" "{}" -if [[ -n "$LEGO_POST_RENEWAL_HOOK" ]]; then +if [[ -n "${LEGO_POST_RENEWAL_HOOK:-}" ]]; then $LEGO_POST_RENEWAL_HOOK fi