Files
jobboard/bin/backend.sh
T

20 lines
810 B
Bash

#!/usr/bin/env bash
# The backend in the foreground until Ctrl-C: uv run app serve, on :8790. The profile's <name>-backend runs it.
# Ours: `-v` and `--config` go before `serve`, where the app takes them, and every other argument
# after it (`--reload`, `--port`), so `.run/serve.run.xml`'s `serve --reload` is `<name>-backend --reload`.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
# A shell started by wsl.exe has not read the rc file that puts uv on PATH.
export PATH="$HOME/.local/bin:$PATH"
before=() after=()
while (($#)); do
case $1 in
-v|--verbose) before+=("$1") ;;
-c|--config) before+=("$1" "${2:?$1 needs a file}"); shift ;;
--config=*) before+=("$1") ;;
*) after+=("$1") ;;
esac
shift
done
exec uv run app "${before[@]}" serve "${after[@]}"