fix: update Caddyfile generation and add /etc/hosts entries for emulator endpoints

This commit is contained in:
2026-03-24 09:58:35 +01:00
parent 149f8a30eb
commit 8c454fa2fc
2 changed files with 10 additions and 6 deletions

View File

@@ -40,6 +40,13 @@ done
if [[ -n "$NO_CADDY" ]]; then
HOST_ARGS=("--blobHost" "0.0.0.0" "--queueHost" "0.0.0.0" "--tableHost" "0.0.0.0")
else
# Create /etc/hosts entries for the emulator endpoints, so that they can be accessed via their standard Azure Storage hostnames.
ALTNAMES=()
for name in blob queue table; do
ALTNAMES+=("${ACCOUNT_NAME}.${name}.core.windows.net")
done
echo "127.0.0.1 ${ALTNAMES[@]}" >> /etc/hosts
# 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.