Files
mirlay/mirasim-relay
2026-08-08 17:28:44 +00:00

27 lines
886 B
Bash
Executable File

#!/bin/sh
# Launcher for mirasim-relay.mjs.
#
# Resolution order for the runtime, widest-override-first:
# 1. $MIRASIM_NODE — explicit override
# 2. node on PATH — needs >= 18 for global fetch; >= 20 in practice
# 3. vendor/node — the v22 binary shipped inside mirasim-server-linux-x64, kept
# alongside this script so the tool is self-contained on a box
# with no system Node at all.
set -eu
DIR="$(cd "$(dirname "$0")" && pwd)"
SCRIPT="$DIR/mirasim-relay.mjs"
if [ -n "${MIRASIM_NODE:-}" ]; then
NODE="$MIRASIM_NODE"
elif command -v node >/dev/null 2>&1; then
NODE="$(command -v node)"
elif [ -x "$DIR/vendor/node" ]; then
NODE="$DIR/vendor/node"
else
echo "mirasim-relay: no Node.js runtime found (set MIRASIM_NODE, install node >= 20, or restore vendor/node)" >&2
exit 1
fi
exec "$NODE" "$SCRIPT" "$@"