This commit is contained in:
Marcelo
2026-02-17 00:07:00 +00:00
parent b7a86a2d1c
commit be4ca2ed78
92 changed files with 6850 additions and 1188 deletions

28
lib/supabase/config.ts Normal file
View File

@@ -0,0 +1,28 @@
const isValidHttpUrl = (value: string): boolean => {
try {
const parsed = new URL(value);
return parsed.protocol === "http:" || parsed.protocol === "https:";
} catch {
return false;
}
};
export type SupabasePublicConfig = {
url: string;
anonKey: string;
};
export const readSupabasePublicConfig = (): SupabasePublicConfig | null => {
const url = process.env.NEXT_PUBLIC_SUPABASE_URL?.trim();
const anonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY?.trim();
if (!url || !anonKey) {
return null;
}
if (!isValidHttpUrl(url)) {
return null;
}
return { url, anonKey };
};