fix: update Caddyfile generation and add /etc/hosts entries for emulator endpoints
This commit is contained in:
@@ -1,33 +1,30 @@
|
|||||||
# Caddyfile for Azure Storage Emulator
|
# Caddyfile for Azure Storage Emulator
|
||||||
__ACCOUNT_NAME__.blob.core.windows.net {
|
__ACCOUNT_NAME__.blob.core.windows.net {
|
||||||
tls __AZURITE_STORAGE__/__ACCOUNT_NAME___cert.pem __AZURITE_STORAGE__/__ACCOUNT_NAME___key.pem
|
tls __AZURITE_STORAGE__/__ACCOUNT_NAME___cert.pem __AZURITE_STORAGE__/__ACCOUNT_NAME___key.pem
|
||||||
reverse_proxy https://127.0.0.1:10000 {
|
reverse_proxy https://__ACCOUNT_NAME__.blob.core.windows.net:10000 {
|
||||||
transport http {
|
transport http {
|
||||||
tls
|
tls
|
||||||
tls_trust_pool file __AZURITE_STORAGE__/ca_cert.pem
|
tls_trust_pool file __AZURITE_STORAGE__/ca_cert.pem
|
||||||
tls_server_name __ACCOUNT_NAME__.blob.core.windows.net
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__ACCOUNT_NAME__.queue.core.windows.net {
|
__ACCOUNT_NAME__.queue.core.windows.net {
|
||||||
tls __AZURITE_STORAGE__/__ACCOUNT_NAME___cert.pem __AZURITE_STORAGE__/__ACCOUNT_NAME___key.pem
|
tls __AZURITE_STORAGE__/__ACCOUNT_NAME___cert.pem __AZURITE_STORAGE__/__ACCOUNT_NAME___key.pem
|
||||||
reverse_proxy https://127.0.0.1:10001 {
|
reverse_proxy https://__ACCOUNT_NAME__.queue.core.windows.net:10001 {
|
||||||
transport http {
|
transport http {
|
||||||
tls
|
tls
|
||||||
tls_trust_pool file __AZURITE_STORAGE__/ca_cert.pem
|
tls_trust_pool file __AZURITE_STORAGE__/ca_cert.pem
|
||||||
tls_server_name __ACCOUNT_NAME__.queue.core.windows.net
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__ACCOUNT_NAME__.table.core.windows.net {
|
__ACCOUNT_NAME__.table.core.windows.net {
|
||||||
tls __AZURITE_STORAGE__/__ACCOUNT_NAME___cert.pem __AZURITE_STORAGE__/__ACCOUNT_NAME___key.pem
|
tls __AZURITE_STORAGE__/__ACCOUNT_NAME___cert.pem __AZURITE_STORAGE__/__ACCOUNT_NAME___key.pem
|
||||||
reverse_proxy https://127.0.0.1:10002 {
|
reverse_proxy https://__ACCOUNT_NAME__.table.core.windows.net:10002 {
|
||||||
transport http {
|
transport http {
|
||||||
tls
|
tls
|
||||||
tls_trust_pool file __AZURITE_STORAGE__/ca_cert.pem
|
tls_trust_pool file __AZURITE_STORAGE__/ca_cert.pem
|
||||||
tls_server_name __ACCOUNT_NAME__.table.core.windows.net
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,13 @@ done
|
|||||||
if [[ -n "$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")
|
HOST_ARGS=("--blobHost" "0.0.0.0" "--queueHost" "0.0.0.0" "--tableHost" "0.0.0.0")
|
||||||
else
|
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.
|
# 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"
|
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.
|
# Start Caddy in the background to handle HTTPS requests and route them to Azurite.
|
||||||
|
|||||||
Reference in New Issue
Block a user