fix: improve error messaging and correct NO_CADDY condition in entrypoint.sh

This commit is contained in:
2026-03-24 09:43:29 +01:00
parent a19036f10d
commit 795e1c6740

View File

@@ -4,7 +4,7 @@ set -euo pipefail
# Check, if the AZURITE_ACCOUNTS variable is set
if [[ -z "$AZURITE_ACCOUNTS" ]]; then
echo "Error: AZURITE_ACCOUNTS variable is not set." >&2
echo "[ERROR] AZURITE_ACCOUNTS variable is not set." >&2
exit 1
fi
@@ -18,7 +18,7 @@ if [[ ! -f "/storage/${ACCOUNT_NAME}_cert.pem" ]] || [[ ! -f "/storage/${ACCOUNT
fi
OAUTH_ARGS=("--oauth" "basic")
NO_CADDY=
NO_CADDY=""
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -37,14 +37,14 @@ while [[ $# -gt 0 ]]; do
esac
done
if [[ -z "$NO_CADDY" ]]; then
if [[ -n "$NO_CADDY" ]]; then
HOST_ARGS=("--blobHost" "0.0.0.0" "--queueHost" "0.0.0.0" "--tableHost" "0.0.0.0")
else
# Generate a Caddyfile configuration based on the account name and storage directory.
sed -E "s/__ACCOUNT_NAME__/${ACCOUNT_NAME}/g; s|__AZURITE_STORAGE__|/storage|g" /app/Caddyfile.template > "/storage/Caddyfile"
# Start Caddy in the background to handle HTTPS requests and route them to Azurite.
caddy start --config "/storage/Caddyfile" # Use start not run, start does not block the shell process.
HOST_ARGS=("--blobHost" "127.0.0.1" "--queueHost" "127.0.0.1" "--tableHost" "127.0.0.1")
else
HOST_ARGS=("--blobHost" "0.0.0.0" "--queueHost" "0.0.0.0" "--tableHost" "0.0.0.0")
fi
PORT_ARGS=("--blobPort" "10000" "--queuePort" "10001" "--tablePort" "10002")