#!/bin/bash
# Expose local MAMP site (tree-of-memory) via ngrok for mobile app testing.
# Requires: ~/bin/ngrok with authtoken configured.

set -e

NGROK="${NGROK_BIN:-$HOME/bin/ngrok}"

if [ ! -x "$NGROK" ]; then
  echo "ngrok not found at $NGROK"
  echo "Download: https://ngrok.com/download"
  exit 1
fi

echo "Starting ngrok → http://tree-of-memory (MAMP vhost)"
echo "Dashboard: http://127.0.0.1:4040"
echo "Press Ctrl+C to stop."
echo ""

exec "$NGROK" http --host-header=rewrite tree-of-memory:80
