Files
azure-storage-emulator/run.sh

45 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
function expose_caddy() {
# Expose Caddy on port 443 and forward to Azurite's blob service on port 10010
EXPOSED_PORTS=("-p" "443:443")
}
function expose_azurite() {
# Expose Azurite's blob, queue, and table services on ports 10010, 10011, and 10012 respectively
EXPOSED_PORTS=("-p" "10000:10010" "-p" "10001:10011" "-p" "10002:10012")
}
function expose_azurite_ssl() {
# Expose Azurite's blob service on port 443 with SSL, and queue and table services on ports 10011 and 10012 respectively
EXPOSED_PORTS=("-p" "443:10010")
}
expose_caddy
while [[ $# -gt 0 ]]; do
case "$1" in
--oauth)
expose_azurite_ssl
shift
;;
--ssl)
expose_azurite_ssl
shift
;;
--no-caddy)
expose_azurite
shift
;;
esac
done
if command -v dockerd &> /dev/null; then
docker run --rm -it --name azurite --env-file accounts.env "${EXPOSED_PORTS[@]}" -v ./storage:/storage azurite:latest "$@"
elif command -v container &> /dev/null; then
container run --rm -it --name azurite --env-file accounts.env "${EXPOSED_PORTS[@]}" --mount type=bind,source=./storage,target=/storage azurite:latest "$@"
else
echo "Neither supported container runtime found." >&2
exit 1
fi