#!/bin/bash
# Add Bar Assistant (cocktails.nianticbooks.com) to Caddy

echo "Adding cocktails.nianticbooks.com to Caddy..."

sudo tee -a /etc/caddy/Caddyfile > /dev/null << 'EOF'

# Bar Assistant - Cocktail Recipe Manager
cocktails.nianticbooks.com {
    reverse_proxy http://10.0.10.40:80 {
        header_up X-Forwarded-For {remote_host}
        header_up X-Real-IP {remote_host}
    }
}
EOF

echo "Configuration added!"
echo ""
echo "Reloading Caddy..."
sudo systemctl reload caddy

echo ""
echo "Testing configuration..."
sleep 3
curl -I https://cocktails.nianticbooks.com 2>&1 | head -5

echo ""
echo "✅ Done! Bar Assistant should now be available at:"
echo "   https://cocktails.nianticbooks.com"
