magicwallet/hotreload.sh
ekzyis 75955f5f84 load .env, init db & lnd, render context
* more scaffolding code from delphi.market
* we now read environment from .env
* we now try to init db and lnd but in a non-blocking way
* we now set "render context" to have access to environment during template render
* frontend can now read commit from HTML attribute
2024-10-26 05:59:37 +02:00

31 lines
507 B
Bash

#!/usr/bin/env bash
# TODO: enumerate directories with shell
WATCH="db/ env/ fonts/ lib/ lightning/ pages/ public/ server/"
BINARY=hermes
PID=
set -e
function restart() {
date +%s.%N > public/__hotreload__
set +e
[[ -z "$PID" ]] || kill -15 $PID
make build -B
set -e
./$BINARY 2>&1 &
PID=$(pidof $BINARY)
}
function cleanup() {
rm -f public/__hotreload__
[[ -z "$PID" ]] || kill -15 $PID
}
trap cleanup EXIT
restart
while inotifywait -r -e modify $WATCH; do
echo
restart
done