19 lines
572 B
TypeScript
19 lines
572 B
TypeScript
import { createClient } from '@supabase/supabase-js';
|
|
import config from '../config';
|
|
|
|
// Validate Supabase URL
|
|
const validateSupabaseUrl = (url: string): string => {
|
|
if (!url || !url.startsWith('http')) {
|
|
console.warn('Invalid Supabase URL provided. Using a placeholder for development.');
|
|
return 'https://example.supabase.co';
|
|
}
|
|
return url;
|
|
};
|
|
|
|
// Create a single supabase client for interacting with your database
|
|
const supabase = createClient(
|
|
validateSupabaseUrl(config.supabase.url),
|
|
config.supabase.key || 'dummy-key'
|
|
);
|
|
|
|
export default supabase;
|