post_enrollment_app/build_web_dev.sh
2025-02-17 17:08:23 +05:30

41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Define the path to the .env.development file
ENV_FILE_PATH=".env.development"
# Check if the .env.development file exists
if [ ! -f $ENV_FILE_PATH ]; then
echo "$ENV_FILE_PATH does not exist"
exit 1
fi
# Copy the .env.development file to .env
cp $ENV_FILE_PATH .env
echo "Copied $ENV_FILE_PATH to .env"
# Source the .env file to load the environment variables
source .env
# Check if the required variables are set
if [ -z "$BASE_HREF" ] || [ -z "$API_URL" ] || [ -z "$TICKET_API_URL" ]; then
echo "Environment variables not set correctly in .env"
exit 1
fi
# Print the loaded variables for verification
echo "Loaded BASE_HREF: $BASE_HREF"
echo "Loaded API_URL: $API_URL"
echo "Loaded TICKET_API_URL: $TICKET_API_URL"
echo "Loaded ticketToken: $ticketToken"
# Build the web app for development with base href
flutter build web --release --base-href "$BASE_HREF"
# Check if the build was successful
if [ $? -ne 0 ]; then
echo "Flutter dev build failed"
exit 1
fi
echo "Flutter dev build succeeded"