#!/bin/sh if [ -z "$REACT_APP_SERVER_BASE_URL" ]; then echo "Error: REACT_APP_SERVER_BASE_URL is not set." exit 1 fi echo "Injecting runtime environment variables into index.html..." CONFIG_BLOCK=$(cat << EOF EOF ) # Use sed to replace the config block in index.html # Using pattern space to match across multiple lines echo "$CONFIG_BLOCK" | sed -i.bak ' //,//{ //!{ //!d } //r /dev/stdin //d } ' build/index.html rm -f build/index.html.bak