- packages/supabase: signIn/signUp/OAuth/reset/updatePassword/signOut wrappers with a closed AuthFailure kind, fetch/update own profile, own platform roles - migration 20261011100000: practice_name, professional_title, siret (format-checked, column grants); pgTAP 009; database.types regenerated - config.toml: TOTP enroll/verify on, [auth.external.google|apple] via env(), wildcard redirect URLs - app config: authProviders (APP_AUTH_PROVIDERS / VITE_AUTH_PROVIDERS), entrypoint env.js, DEPLOY table - TODO: Step 7 plan
49 lines
1.7 KiB
Bash
49 lines
1.7 KiB
Bash
#!/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" <<EOF
|
|
window.__APP_CONFIG__ = {
|
|
siteName: "${SITE_NAME}",
|
|
brandName: "${BRAND_NAME}",
|
|
footerName: "${FOOTER_NAME}",
|
|
tagline: "${TAGLINE}",
|
|
supabaseUrl: "${SUPABASE_URL}",
|
|
supabaseAnonKey: "${SUPABASE_ANON_KEY}",
|
|
authProviders: "${AUTH_PROVIDERS}"
|
|
};
|
|
EOF
|
|
|
|
echo "env.js written: APP_BRAND_NAME=${APP_BRAND_NAME:-Faunosteo}"
|
|
|
|
# Replace PORT placeholder in nginx config if needed
|
|
# (nginx:alpine supports envsubst via templates; we keep it explicit)
|
|
export PORT="${PORT:-8080}"
|
|
envsubst '${PORT}' < /etc/nginx/conf.d/default.conf > /tmp/nginx_default.conf
|
|
cp /tmp/nginx_default.conf /etc/nginx/conf.d/default.conf
|
|
|
|
exec nginx -g "daemon off;"
|