#!/bin/bash
# Process HTML template with environment variables
# This script substitutes environment variables in index.html.template
set -e
# Default values
APP_NAME="${APP_NAME:-RxMinder}"
# Input and output files
TEMPLATE_FILE="index.html.template"
OUTPUT_FILE="index.html"
# Check if template exists
if [[ ! -f "$TEMPLATE_FILE" ]]; then
echo "Error: Template file $TEMPLATE_FILE not found"
exit 1
fi
# Process template with environment variable substitution
envsubst '$APP_NAME' < "$TEMPLATE_FILE" > "$OUTPUT_FILE"
echo "✅ Processed $TEMPLATE_FILE -> $OUTPUT_FILE with APP_NAME=$APP_NAME"