post_enrollment_app/build_web_production.sh
venbaittech b5d77d2426 CHANGE_
2024-07-28 11:50:54 +05:30

40 lines
1000 B
Bash
Executable File

#!/bin/bash
# Define the path to the .env.production file
ENV_FILE_PATH=".env.production"
# Check if the .env.production file exists
if [ ! -f $ENV_FILE_PATH ]; then
echo "$ENV_FILE_PATH does not exist"
exit 1
fi
# Copy the .env.production 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"
# Build the web app for production with base href
flutter build web --release --base-href "$BASE_HREF"
# Check if the build was successful
if [ $? -ne 0 ]; then
echo "Flutter PRODUCTION build failed"
exit 1
fi
echo "Flutter PRODUCTION build succeeded"