Files
overlord/scripts/start-dev-server.sh
T

32 lines
984 B
Bash

#!/usr/bin/env bash
set -eu
SCRIPT_DIR="$(cd -- "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(cd -- "$SCRIPT_DIR/.." && pwd)"
SERVER_DIR="$ROOT/Overlord-Server"
BUN_BIN="${BUN_BIN:-bun}"
# detect platform
OS="$(uname -s)"
case "$OS" in
Darwin) PLATFORM="mac";;
Linux) PLATFORM="linux";;
*) PLATFORM="unknown";;
esac
echo "[server] platform detected: $OS ($PLATFORM)"
cd "$SERVER_DIR"
if ! command -v "$BUN_BIN" >/dev/null 2>&1; then
echo "[server] bun not found. Set BUN_BIN to your bun binary or install bun for this environment." >&2
exit 1
fi
echo "[server] using bun at: $(command -v $BUN_BIN)"
echo "[server] bun install..."
"$BUN_BIN" install
echo "[server] starting bun dev (foreground)"
# Use exec so the script process is replaced by the bun process. This keeps the
# bun process as a child of the dispatcher so the dispatcher can kill it.
export OVERLORD_AGENT_TOKEN="dev-token-insecure-local-only"
export NODE_ENV="development"
exec "$BUN_BIN" run dev