#!/bin/bash
cd ~/library.mytunnel.ca
source ~/.nvm/nvm.sh

# Kill any existing process
pkill -f "node.*server.js" 2>/dev/null || true
sleep 1

# Start the server
DB_HOST=localhost \
DB_USER=mytunne5_library \
DB_PASSWORD=LibraryPass2024Secure \
DB_NAME=mytunne5_library \
BASE_URL=https://library.mytunnel.ca \
NODE_ENV=production \
nohup node server.js > app.log 2>&1 &

echo "Server started. PID: $!"
