mirror of
https://github.com/ivabus/pantry
synced 2024-11-10 10:35:17 +03:00
32 lines
519 B
Bash
Executable file
32 lines
519 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -em
|
|
|
|
# source <(tea +curl.se)
|
|
|
|
PORT=43873 #TODO find a port automatically!
|
|
|
|
openplayground run --port $PORT &
|
|
|
|
PID=$!
|
|
|
|
# poll until a HEAD request succeeds
|
|
while ! curl -Is http://127.0.0.1:$PORT | grep -q "HTTP/1.1 200 OK"; do
|
|
if ! kill -0 $PID; then
|
|
echo "webui process died!"
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
# open the URL once the HEAD request succeeds
|
|
if test -n "$TEA_GUI"; then
|
|
echo
|
|
echo '{"xyz.tea":{"gui":"http://127.0.0.1:5432"}}'
|
|
echo
|
|
else
|
|
open "http://127.0.0.1:$PORT"
|
|
fi
|
|
|
|
fg
|