Remove demo fallbacks and require Supabase configuration
cgen-4d661c08fb904cf28ee2df7d8745dbb7
This commit is contained in:
parent
e3da687c49
commit
8b06e9cc71
1 changed files with 12 additions and 21 deletions
|
|
@ -4,29 +4,20 @@ import type { Database } from "./database.types";
|
||||||
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
|
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
|
||||||
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY;
|
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY;
|
||||||
|
|
||||||
// Check if Supabase is configured
|
// Validate required environment variables
|
||||||
export const isSupabaseConfigured = !!(
|
if (!supabaseUrl || !supabaseAnonKey) {
|
||||||
supabaseUrl &&
|
throw new Error(
|
||||||
supabaseAnonKey &&
|
"Missing Supabase environment variables. Please configure VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY"
|
||||||
supabaseUrl !== "https://your-project-ref.supabase.co" &&
|
);
|
||||||
supabaseAnonKey !== "your-anon-key-here"
|
}
|
||||||
);
|
|
||||||
|
|
||||||
// Use fallback values for development if not configured
|
export const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey, {
|
||||||
const fallbackUrl = "https://demo.supabase.co";
|
auth: {
|
||||||
const fallbackKey = "demo-key";
|
autoRefreshToken: true,
|
||||||
|
persistSession: true,
|
||||||
export const supabase = createClient<Database>(
|
detectSessionInUrl: true,
|
||||||
supabaseUrl || fallbackUrl,
|
|
||||||
supabaseAnonKey || fallbackKey,
|
|
||||||
{
|
|
||||||
auth: {
|
|
||||||
autoRefreshToken: isSupabaseConfigured,
|
|
||||||
persistSession: isSupabaseConfigured,
|
|
||||||
detectSessionInUrl: isSupabaseConfigured,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
);
|
});
|
||||||
|
|
||||||
// Auth helpers
|
// Auth helpers
|
||||||
export const auth = supabase.auth;
|
export const auth = supabase.auth;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue