treehouse/admin/daemon.bash
liquidex c58c07d846 version history MVP
implement basic version history support; there's now an icon in the footer that lets you see the previous versions and their sources
I'm a bit worried about spoilers but honestly it's yet another way to hint yourself at the cool secrets so I don't mind
2024-09-28 23:45:06 +02:00

30 lines
580 B
Bash
Executable file

#!/usr/bin/env bash
source "${BASH_SOURCE%/*}/daemon/common.bash"
echo "PATH: $PATH"
trap 'trap - SIGTERM && kill 0' SIGTERM SIGINT EXIT
rm -f $reload_fifo
mkfifo $reload_fifo
reload() {
# This just kind of assumes regeneration doesn't take too long.
cargo build --release
kill "$treehouse_pid"
cargo run --release -- serve --port 8082 --commits-only > "$build_log" 2>&1 &
treehouse_pid="$!"
}
reload
while true; do
read command < "$reload_fifo"
case "$command" in
reload)
echo "Reloading"
reload;;
esac
done