#!/bin/bash

# Test environment configuration

echo "🧪 Testing environment configuration..."

echo ""
echo "=== Backend Environment ==="
echo "Current .env DATABASE_HOST:"
grep DATABASE_HOST backend/.env || echo "Not found"

echo ""
echo "Backend .env.local DATABASE_HOST:"
grep DATABASE_HOST backend/.env.local || echo "Not found"

echo ""
echo "=== Frontend Environment ==="
echo "Current .env VITE_API_URL:"
grep VITE_API_URL frontend/.env || echo "Not found"

echo ""
echo "Frontend .env.local VITE_API_URL:"
grep VITE_API_URL frontend/.env.local || echo "Not found"

echo ""
echo "=== Docker Compose ==="
echo "Checking Docker Compose configuration..."
if grep -q "env_file:" docker-compose.dev.yml; then
    echo "✓ env_file directive is present"
else
    echo "✗ env_file directive not found"
fi

echo ""
echo "✅ Environment test complete!"
echo ""
echo "To switch to local mode:"
echo "  backend: npm run dev:local"
echo "  frontend: npm run dev:local"
echo ""
echo "To reset to Docker mode:"
echo "  npm run reset:env"