ChatSmith_3 / frontend /src /supabaseClient.js
umer6016
Fix: Trim whitespace from Supabase env vars
40fa926
raw
history blame contribute delete
627 Bytes
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);