init
This commit is contained in:
19
backend/src/utils/supabase.ts
Normal file
19
backend/src/utils/supabase.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user