#!/bin/sh # Injects runtime env vars into /usr/share/nginx/html/env.js # which is loaded by index.html before the React bundle. # Values come from Docker env vars (set via env_file in docker-compose.yml). set -e ENV_JS="/usr/share/nginx/html/env.js" # Escapes a value for safe embedding in a double-quoted JS string literal # (backslashes, double quotes; newlines collapsed to spaces). js_escape() { printf '%s' "$1" | tr '\n' ' ' | sed 's/\\/\\\\/g; s/"/\\"/g' } SITE_NAME=$(js_escape "${APP_SITE_NAME:-Faunosteo}") BRAND_NAME=$(js_escape "${APP_BRAND_NAME:-Faunosteo}") FOOTER_NAME=$(js_escape "${APP_FOOTER_NAME:-Faunosteo}") TAGLINE=$(js_escape "${APP_TAGLINE:-Outils pour ostéopathes animaliers}") # Supabase public connection (anon key only; empty = backend disabled). # The service-role key must never be set here. SUPABASE_URL=$(js_escape "${APP_SUPABASE_URL:-}") SUPABASE_ANON_KEY=$(js_escape "${APP_SUPABASE_ANON_KEY:-}") # OAuth buttons offered by the auth screens ("google,apple"); the Supabase # project must enable the same providers. AUTH_PROVIDERS=$(js_escape "${APP_AUTH_PROVIDERS:-}") cat > "$ENV_JS" < /tmp/nginx_default.conf cp /tmp/nginx_default.conf /etc/nginx/conf.d/default.conf exec nginx -g "daemon off;"