Refactored scripts to focues on compatibility with the real product.

This commit is contained in:
2026-02-28 09:34:52 +01:00
parent c65c347ca5
commit ae7542100b
10 changed files with 135 additions and 246 deletions

30
run.sh
View File

@@ -1,36 +1,12 @@
#!/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
-o|--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|-s|--no-caddy|-n)
CONTAINER_ARGS+=("$1")
EXPOSED_PORTS=("-p" "10000:10000" "-p" "10001:10001" "-p" "10002:10002")
shift
;;
*)
@@ -40,12 +16,10 @@ while [[ $# -gt 0 ]]; do
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[@]}"
docker run --rm -it --name azurite --env-file accounts.env -p 443:443 -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[@]}"
container run --rm -it --name azurite --env-file accounts.env -p 443:443 --mount type=bind,source=./storage,target=/storage azurite:latest "${CONTAINER_ARGS[@]}"
else
echo "Neither supported container runtime found." >&2
exit 1