File size: 627 Bytes
04f25f0
 
674f2e1
 
 
 
 
 
 
04f25f0
40fa926
 
674f2e1
 
 
 
 
40fa926
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { createClient } from "@supabase/supabase-js";

// Check for runtime config (injected by backend) or build-time config (local dev)
const getEnv = (key) => {
    if (typeof window !== "undefined" && window.__ENV__ && window.__ENV__[key]) {
        return window.__ENV__[key];
    }
    return import.meta.env[key];
};

const supabaseUrl = (getEnv("VITE_SUPABASE_URL") || "").trim();
const supabaseKey = (getEnv("VITE_SUPABASE_ANON_KEY") || "").trim();

if (!supabaseUrl || !supabaseKey) {
    console.warn("Supabase credentials missing! App may fail.");
}

export const supabase = createClient(supabaseUrl, supabaseKey);