File size: 760 Bytes
7d72a03 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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};`
}}
/>
)
}
|