Files
azure-storage-emulator/run.sh

49 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# By default Caddy exposes the SSL termination endpoint and
# uses DNS name to determine which service to route to.
EXPOSED_PORTS=("-p" "443:443")
CONTAINER_ARGS=()
while [[ $# -gt 0 ]]; do
case "$1" in
--oauth)
# OAuth support
case "$2" in
blob)
EXPOSED_PORTS=("-p" "443:10000")
;;
queue)
EXPOSED_PORTS=("-p" "443:10001")
;;
table)
EXPOSED_PORTS=("-p" "443:10002")
;;
*)
echo "Error: --oauth must be followed by 'blob', 'queue', or 'table'." >&2
exit 1
;;
esac
CONTAINER_ARGS+=("--oauth")
shift 2
;;
--ssl|--no-caddy)
CONTAINER_ARGS+=("$1")
EXPOSED_PORTS=("-p" "10000:10000" "-p" "10001:10001" "-p" "10002:10002")
shift
;;
esac
done
echo "Using exposed ports: ${EXPOSED_PORTS[*]}"
if command -v dockerd &> /dev/null; then
docker run --rm -it --name azurite --env-file accounts.env "${EXPOSED_PORTS[@]}" -v ./storage:/storage azurite:latest "${CONTAINER_ARGS[@]}"
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 "${CONTAINER_ARGS[@]}"
else
echo "Neither supported container runtime found." >&2
exit 1
fi