fix: update port exposure logic and enhance OAuth handling in run script
This commit is contained in:
@@ -107,7 +107,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--no-caddy)
|
--no-caddy)
|
||||||
# Disable Caddy on request.
|
# Disable Caddy, but do not enable SSL for Azurite.
|
||||||
CADDY=""
|
CADDY=""
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
@@ -146,9 +146,9 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Start Azurite with the appropriate arguments based on the configuration.
|
||||||
exec node /app/azurite/src/azurite.js \
|
exec node /app/azurite/src/azurite.js \
|
||||||
--disableTelemetry \
|
--disableTelemetry \
|
||||||
--location "$AZURITE_DIR" \
|
--location "$AZURITE_DIR" \
|
||||||
--blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 \
|
--blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0 \
|
||||||
--blobPort 10010 --queuePort 10011 --tablePort 10012 \
|
|
||||||
"${CERT_ARGS[@]}" "${OAUTH_ARGS[@]}"
|
"${CERT_ARGS[@]}" "${OAUTH_ARGS[@]}"
|
||||||
|
|||||||
52
run.sh
52
run.sh
@@ -1,43 +1,47 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
function expose_caddy() {
|
# By default Caddy exposes the SSL termination endpoint and
|
||||||
# Expose Caddy on port 443 and forward to Azurite's blob service on port 10010
|
# uses DNS name to determine which service to route to.
|
||||||
EXPOSED_PORTS=("-p" "443:443")
|
EXPOSED_PORTS=("-p" "443:443")
|
||||||
}
|
|
||||||
|
|
||||||
function expose_azurite() {
|
CONTAINER_ARGS=()
|
||||||
# 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
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--oauth)
|
--oauth)
|
||||||
expose_azurite_ssl
|
# OAuth support
|
||||||
shift
|
case "$2" in
|
||||||
|
blob)
|
||||||
|
EXPOSED_PORTS=("-p" "443:10000")
|
||||||
;;
|
;;
|
||||||
--ssl)
|
queue)
|
||||||
expose_azurite_ssl
|
EXPOSED_PORTS=("-p" "443:10001")
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
--no-caddy)
|
table)
|
||||||
expose_azurite
|
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
|
shift
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Using exposed ports: ${EXPOSED_PORTS[*]}"
|
||||||
|
|
||||||
if command -v dockerd &> /dev/null; then
|
if command -v dockerd &> /dev/null; then
|
||||||
docker run --rm -it --name azurite --env-file accounts.env "${EXPOSED_PORTS[@]}" -v ./storage:/storage azurite:latest "$@"
|
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
|
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 run --rm -it --name azurite --env-file accounts.env "${EXPOSED_PORTS[@]}" --mount type=bind,source=./storage,target=/storage azurite:latest "${CONTAINER_ARGS[@]}"
|
||||||
else
|
else
|
||||||
echo "Neither supported container runtime found." >&2
|
echo "Neither supported container runtime found." >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user