#!/bin/bash # Freezone Platform Server Runner # This script sets up and runs the complete Stripe-integrated server echo "๐Ÿš€ Starting Freezone Platform with Stripe Integration" echo "==================================================" # Check if .env file exists if [ ! -f ".env" ]; then echo "โŒ .env file not found!" echo "๐Ÿ“‹ Please copy .env.example to .env and add your Stripe keys:" echo " cp .env.example .env" echo " # Then edit .env with your actual Stripe keys" exit 1 fi # Check if Stripe keys are configured if grep -q "YOUR_ACTUAL" .env; then echo "โš ๏ธ Warning: .env file contains placeholder values" echo "๐Ÿ“‹ Please update .env with your real Stripe API keys from:" echo " https://dashboard.stripe.com/apikeys" echo "" echo "๐ŸŽญ Running in demo mode (server will still start)..." echo "" fi # Load environment variables source .env echo "๐Ÿ”ง Building server with Stripe integration..." cargo build --bin server --features server if [ $? -ne 0 ]; then echo "โŒ Build failed! Please check the error messages above." exit 1 fi echo "โœ… Build successful!" echo "" echo "๐ŸŒ Starting server on http://${HOST:-127.0.0.1}:${PORT:-8080}" echo "๐Ÿ“Š Health check: http://${HOST:-127.0.0.1}:${PORT:-8080}/api/health" echo "๐Ÿ’ณ Payment endpoint: http://${HOST:-127.0.0.1}:${PORT:-8080}/company/create-payment-intent" echo "" echo "๐Ÿงช To test the integration:" echo " 1. Open http://${HOST:-127.0.0.1}:${PORT:-8080} in your browser" echo " 2. Navigate to the entities page" echo " 3. Go through the company registration steps" echo " 4. In step 4, you'll see Stripe Elements instead of manual form" echo "" echo "๐Ÿ”„ Press Ctrl+C to stop the server" echo "==================================================" # Run the server cargo run --bin server --features server