Files
cms-automotivo/lib/supabase.ts
MMrp89 c0bd6d7e3d feat: Initialize CAR Auto Center project with Vite and React
Sets up the foundational structure for the CAR Auto Center application using Vite and React. Includes project dependencies, basic HTML structure, TypeScript configuration, and initial README content. This commit establishes the project's build tool, core libraries, and essential configuration files.
2026-02-19 16:22:10 -03:00

18 lines
768 B
TypeScript

import { createClient } from '@supabase/supabase-js';
// NOTA: Em produção, estas variáveis devem estar no .env
// Para teste imediato, se as variáveis não existirem, o sistema usará localStorage
// Safely access environment variables
const envUrl = (import.meta as any).env?.VITE_SUPABASE_URL;
const envKey = (import.meta as any).env?.VITE_SUPABASE_ANON_KEY;
// Fallback to placeholder values to prevent createClient from throwing "supabaseUrl is required" error
const supabaseUrl = envUrl || 'https://placeholder.supabase.co';
const supabaseAnonKey = envKey || 'placeholder';
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
export const isSupabaseConfigured = () => {
return !!envUrl && !!envKey && envUrl !== '' && envKey !== '';
};