#!/usr/bin/env bash # Start the mchost-hosted Fabric server (server/fabric-server-launch.jar). # # ./start.sh quick tunnel, random invite secret # SECRET=hunter2 ./start.sh stable invite secret (same invite format) # TOKEN=eyJh... PUBLIC_HOST=mc.example.com ./start.sh named tunnel on your domain # MEMORY=4G ./start.sh JVM heap for the Minecraft server # ./start.sh --no-tunnel local only # ./start.sh --cloudflared /path/to/cloudflared # # Any extra arguments are passed straight through to mchost. # DRY_RUN=1 ./start.sh prints the command instead of running it. set -euo pipefail cd "$(dirname "$0")" MCHOST=target/release/mchost SERVER_JAR=server/fabric-server-launch.jar if [[ ! -x "$MCHOST" ]]; then echo "[start] mchost binary not found; building it with cargo..." cargo build --release fi if [[ ! -f "$SERVER_JAR" ]]; then echo "[start] error: $SERVER_JAR is missing." >&2 echo "[start] Install the Fabric server first (see mod/README.md or README.md)." >&2 exit 1 fi # Invite secret: SECRET=... for a stable one, otherwise random per run so old # invites stop working when you restart. SECRET="${SECRET:-$(tr -dc 'a-z0-9'