fix: move interactive prompt before unbuffer exec so read works

This commit is contained in:
root
2026-06-24 12:39:50 +02:00
parent f47dddfa56
commit e4b7eec79f
+11 -6
View File
@@ -11,6 +11,17 @@ if [ -f "$SCRIPT_DIR/.env" ]; then
set +a set +a
fi fi
# Prompt for site URL before unbuffer exec, so interactive input works
if [ -z "${NITRO_SITE_URL:-}" ]; then
read -r -p "Enter your site URL (e.g. https://example.com): " NITRO_SITE_URL
NITRO_SITE_URL="${NITRO_SITE_URL%/}"
if [ -z "$NITRO_SITE_URL" ]; then
echo "=== ❌ NITRO_SITE_URL is required. Set it in .env or enter it now. ==="
exit 1
fi
export NITRO_SITE_URL
fi
# Real-time output via pseudo-terminal (unbuffer from expect) # Real-time output via pseudo-terminal (unbuffer from expect)
if [ -z "${_UNBUFFERED:-}" ] && command -v unbuffer &> /dev/null; then if [ -z "${_UNBUFFERED:-}" ] && command -v unbuffer &> /dev/null; then
export _UNBUFFERED=1 export _UNBUFFERED=1
@@ -42,12 +53,6 @@ NITRO_CLIENT="${NITRO_CLIENT_SRC:-/var/www/Nitro-V3}"
NITRO_RENDERER="${NITRO_RENDERER_SRC:-/var/www/Nitro_Render_V3}" NITRO_RENDERER="${NITRO_RENDERER_SRC:-/var/www/Nitro_Render_V3}"
NITRO_BRANCH="${NITRO_BRANCH:-main}" NITRO_BRANCH="${NITRO_BRANCH:-main}"
# Prompt for site URL if not set, so it works on any VPS
while [ -z "${NITRO_SITE_URL:-}" ]; do
read -r -p "Enter your site URL (e.g. https://example.com): " NITRO_SITE_URL
NITRO_SITE_URL="${NITRO_SITE_URL%/}"
done
# Derive ws/wss protocol from the site scheme # Derive ws/wss protocol from the site scheme
case "$NITRO_SITE_URL" in case "$NITRO_SITE_URL" in
https://*) NITRO_WS_PROTO="wss://" ; NITRO_DOMAIN="${NITRO_SITE_URL#https://}" ;; https://*) NITRO_WS_PROTO="wss://" ; NITRO_DOMAIN="${NITRO_SITE_URL#https://}" ;;