From 3f84c85e3e91ec377a55b4180d104651cafa4ecb Mon Sep 17 00:00:00 2001 From: ngutech21 Date: Sat, 16 Dec 2023 08:41:22 +0100 Subject: [PATCH] chore: add error handling to entrypoint.sh --- entrypoint.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 70c60249..96857d7b 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,21 @@ # Decode the base64 environment variables and write them to files mkdir -p /lndconf echo "$LND_MACAROON_BASE64" | base64 -d > /lndconf/admin.macaroon +if [ $? -ne 0 ]; then + echo "LND_MACAROON_BASE64 is not valid base64" + exit 1 +fi + echo "$LND_TLS_CERT_BASE64" | base64 -d > /lndconf/tls.cert +if [ $? -ne 0 ]; then + echo "LND_TLS_CERT_BASE64 is not valid base64" + exit 1 +fi + +# Restrict permissions of the files +chmod 700 /lndconf +chmod 400 /lndconf/admin.macaroon +chmod 400 /lndconf/tls.cert # Start your application exec "$@" \ No newline at end of file