-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.sh
More file actions
executable file
·28 lines (23 loc) · 922 Bytes
/
web.sh
File metadata and controls
executable file
·28 lines (23 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
set -euo pipefail
###############################################################################
# web.sh — Coin Smith: PSBT builder web UI and visualizer
#
# Starts the web server for the PSBT transaction builder.
#
# Behavior:
# - Reads PORT env var (default: 3000)
# - Prints the URL (e.g., http://127.0.0.1:3000) to stdout
# - Keeps running until terminated (CTRL+C / SIGTERM)
# - Must serve GET /api/health -> 200 { "ok": true }
#
###############################################################################
PORT="${PORT:-3000}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WEB_BIN="$SCRIPT_DIR/coin-smith/target/release/web"
if [[ ! -x "$WEB_BIN" ]]; then
echo "Error: Missing web binary at coin-smith/target/release/web. Run ./setup.sh first." >&2
exit 1
fi
# Run and keep alive; the binary prints the URL to stdout as required.
PORT="$PORT" exec "$WEB_BIN"