Merge pull request #44 from Dvorinka/fix/install-prompt-tty

fix(install): prompt on /dev/tty under curl|bash
This commit is contained in:
Tomáš Dvořák authored and GitHub committed 2026-09-28 20:22:14 +02:00
commit da294aaa2b
2 files changed
+7 -6

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ All notable changes to Primora. Format follows [Keep a Changelog](https://keepac
### Added ### Added
- **Install script asks for the public URL** — `install.sh` now prompts for where you'll open the app and accepts a full URL: `https://primora.example.com` (TLS at your proxy, hints printed at the end), `primora.example.com`, or `192.168.1.50:8085` (the port becomes `NGINX_PORT`). The answer rewrites every public URL var in `.env` and `COOKIE_DOMAIN` for real DNS names. Non-interactive via `PUBLIC_URL=`; legacy `DOMAIN`/`NGINX_PORT` envs still work; reruns over an existing `.env` skip the question. - **Install script asks for the public URL** — `install.sh` now prompts for where you'll open the app and accepts a full URL: `https://primora.example.com` (TLS at your proxy, hints printed at the end), `primora.example.com`, or `192.168.1.50:8085` (the port becomes `NGINX_PORT`). The answer rewrites every public URL var in `.env` and `COOKIE_DOMAIN` for real DNS names. The prompt reads the controlling terminal so it appears under `curl | bash`; no tty (CI, cron) falls back to `localhost`. Non-interactive via `PUBLIC_URL=`; legacy `DOMAIN`/`NGINX_PORT` envs still work; reruns over an existing `.env` skip the question.
## [0.8.2] - 2026-09-28 ## [0.8.2] - 2026-09-28
+6 -5
View File
@@ -57,12 +57,13 @@ else
if [ -z "$PUBLIC_URL" ]; then if [ -z "$PUBLIC_URL" ]; then
DEFAULT_URL="http://localhost" DEFAULT_URL="http://localhost"
[ "$NGINX_PORT" != "80" ] && DEFAULT_URL="http://localhost:$NGINX_PORT" [ "$NGINX_PORT" != "80" ] && DEFAULT_URL="http://localhost:$NGINX_PORT"
if [ -t 0 ]; then # Under `curl | bash` stdin is the script pipe — prompt on the
read -rp "URL where you'll open Primora (domain or IP, e.g. https://primora.example.com) [$DEFAULT_URL]: " PUBLIC_URL # controlling terminal instead. No tty (CI/cron) → default silently.
PUBLIC_URL="${PUBLIC_URL:-$DEFAULT_URL}" if exec 9</dev/tty 2>/dev/null; then
else read -rp "URL where you'll open Primora (domain or IP, e.g. https://primora.example.com) [$DEFAULT_URL]: " PUBLIC_URL <&9 || true
PUBLIC_URL="$DEFAULT_URL" exec 9>&-
fi fi
PUBLIC_URL="${PUBLIC_URL:-$DEFAULT_URL}"
fi fi
# Normalize: default scheme http, strip trailing slash. # Normalize: default scheme http, strip trailing slash.