| import { getSupabaseBrowserAnonKey, getSupabaseBrowserUrl } from 'lib/supabase/publicEnv' | |
| /** | |
| * Injects runtime Supabase public config into the window object so that | |
| * client bundles built without NEXT_PUBLIC_* can still pick up secrets | |
| * provided at container runtime (e.g., Hugging Face Space rebuilds). | |
| */ | |
| export function SupabaseConfigScript() { | |
| const url = getSupabaseBrowserUrl() | |
| const anonKey = getSupabaseBrowserAnonKey() | |
| if (!url || !anonKey) return null | |
| const serialized = JSON.stringify({ url, anonKey }) | |
| return ( | |
| <script | |
| // We intentionally set a global to make the public keys available to the client. | |
| dangerouslySetInnerHTML={{ | |
| __html: `window.__SUPABASE_CONFIG__ = ${serialized};` | |
| }} | |
| /> | |
| ) | |
| } | |