fleet-memory/scripts/dev/start-control-plane.sh
2025-12-02 18:28:57 +01:00

36 lines
No EOL
1,016 B
Bash
Executable file

#!/bin/bash
set -e
ROOT_DIR="$(git rev-parse --show-toplevel)"
cd "$ROOT_DIR/hindsight-control-plane" || exit 1
# Check if .env exists in workspace root
if [ ! -f "$ROOT_DIR/.env" ]; then
echo "⚠️ Warning: .env not found in workspace root at $ROOT_DIR/.env"
echo "📝 Please create a .env file if you need to set HINDSIGHT_CP_DATAPLANE_API_URL"
echo " Default will use http://localhost:8888"
echo ""
fi
echo "🔨 Building TypeScript SDK first to ensure it's up to date..."
cd "$ROOT_DIR/hindsight-clients/typescript" || exit 1
npm run build
echo "✅ SDK built successfully"
echo ""
cd "$ROOT_DIR/hindsight-control-plane" || exit 1
echo "🚀 Starting Control Plane (Next.js dev server)..."
if [ -f "$ROOT_DIR/.env" ]; then
echo "📄 Loading environment from $ROOT_DIR/.env"
# Load env vars from root .env file
set -a
source "$ROOT_DIR/.env"
set +a
fi
# Map prefixed env vars to Next.js standard vars
export HOSTNAME="${HINDSIGHT_CP_HOSTNAME:-0.0.0.0}"
# Run dev server
npm run dev