#!/bin/bash ENVIRONMENT=$1 if [ "$ENVIRONMENT" = "testing" ]; then echo "🧪 Switching to TESTING environment..." # Backend cd backend if [ -f .env.testing ]; then cp .env.testing .env echo "✅ Backend environment switched to testing" else echo "⚠️ Backend .env.testing file not found. Please create it first." fi # Switch Firebase project if command -v firebase &> /dev/null; then firebase use testing 2>/dev/null || echo "⚠️ Firebase testing project not configured" fi # Frontend cd ../frontend if [ -f .env.testing ]; then cp .env.testing .env echo "✅ Frontend environment switched to testing" else echo "⚠️ Frontend .env.testing file not found. Please create it first." fi # Switch Firebase project if command -v firebase &> /dev/null; then firebase use testing 2>/dev/null || echo "⚠️ Firebase testing project not configured" fi echo "✅ Switched to testing environment" echo "Backend: https://us-central1-cim-summarizer-testing.cloudfunctions.net/api" echo "Frontend: https://cim-summarizer-testing.web.app" elif [ "$ENVIRONMENT" = "production" ]; then echo "🏭 Switching to PRODUCTION environment..." # Backend cd backend if [ -f .env.production ]; then cp .env.production .env echo "✅ Backend environment switched to production" else echo "⚠️ Backend .env.production file not found. Please create it first." fi # Switch Firebase project if command -v firebase &> /dev/null; then firebase use production 2>/dev/null || echo "⚠️ Firebase production project not configured" fi # Frontend cd ../frontend if [ -f .env.production ]; then cp .env.production .env echo "✅ Frontend environment switched to production" else echo "⚠️ Frontend .env.production file not found. Please create it first." fi # Switch Firebase project if command -v firebase &> /dev/null; then firebase use production 2>/dev/null || echo "⚠️ Firebase production project not configured" fi echo "✅ Switched to production environment" else echo "❌ Usage: ./switch-environment.sh [testing|production]" echo "" echo "Available environments:" echo " testing - Switch to testing environment" echo " production - Switch to production environment" echo "" echo "Note: Make sure .env.testing and .env.production files exist in both backend/ and frontend/ directories" exit 1 fi