Files
openresty-gateway/reload.sh
2026-05-18 22:56:05 +08:00

27 lines
580 B
Bash

#!/usr/bin/env sh
set -eu
# Validate config, then reload OpenResty after conf changes.
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
cd "$ROOT_DIR"
. "$ROOT_DIR/scripts/lib-compose.sh"
echo "Validating Docker Compose configuration..."
compose config >/dev/null
echo "Validating OpenResty configuration..."
compose exec -T openresty openresty -t
echo "Reloading OpenResty..."
if compose exec -T openresty openresty -s reload; then
echo "OpenResty reloaded."
else
echo "Reload failed; restarting OpenResty..."
compose restart openresty
fi
echo "Done."