#!/bin/sh # Render the runtime config from container env so a single built image serves # any deployment. Runs before nginx starts (nginx /docker-entrypoint.d hook). set -eu # Values are written into JavaScript string literals, so a double quote, a # backslash or a line break in one would end the literal early and take the # whole config with it, leaving the app with no API_URL at all. Escape rather # than trust whatever ended up in .env. js() { printf '%s' "$1" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' | tr -d '\r\n' } cat > /usr/share/nginx/html/config.js <