Merge remote-tracking branch 'origin/main'

This commit is contained in:
T. Zehetbauer
2026-04-01 09:31:25 +02:00
3 changed files with 20 additions and 5 deletions

View File

@@ -2,8 +2,18 @@ import * as z from 'zod';
/**
* Returns and validates the Supabase client keys from the environment.
*
* On the server, prefers SUPABASE_INTERNAL_URL (Docker-internal)
* over NEXT_PUBLIC_SUPABASE_URL (external domain) to avoid
* hairpin NAT / DNS issues in containerized deployments.
*/
export function getSupabaseClientKeys() {
const isServer = typeof window === 'undefined';
const url = isServer
? (process.env.SUPABASE_INTERNAL_URL || process.env.NEXT_PUBLIC_SUPABASE_URL)
: process.env.NEXT_PUBLIC_SUPABASE_URL;
return z
.object({
url: z.string({
@@ -14,7 +24,7 @@ export function getSupabaseClientKeys() {
}),
})
.parse({
url: process.env.NEXT_PUBLIC_SUPABASE_URL,
url,
publicKey: process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_KEY,
});
}