#!/bin/bash
# Roster Guru PRO - Production Start Script
# Cara pakai: ./start.sh
# Akses: http://localhost:3000

cd "$(dirname "$0")"

echo "================================"
echo "  Roster Guru PRO - Starting..."
echo "================================"
echo ""

# Set environment
export NODE_ENV=production
export PORT=3000
export HOSTNAME=0.0.0.0

# Check if bun is available, otherwise use node
if command -v bun &> /dev/null; then
    echo "Using Bun runtime..."
    cd standalone && bun server.js
elif command -v node &> /dev/null; then
    echo "Using Node.js runtime..."
    cd standalone && node server.js
else
    echo "ERROR: Neither bun nor node is installed!"
    echo "Please install Node.js 18+ or Bun"
    exit 1
fi
