Dashboard-Automatizase/lib/supabase-admin.ts
Luis Erlacher 0152a2fda0 feat: add n8n API testing script for Google OAuth2 schema and existing credentials
- Implemented a bash script to test n8n API and retrieve credential schemas.
- Added types for API responses, Google Calendar, and WhatsApp instances.
- Configured Vitest for testing with React and added setup for testing-library.
2025-10-10 14:29:02 -03:00

24 lines
760 B
TypeScript

import { createClient } from "@supabase/supabase-js";
// IMPORTANTE: Este arquivo só deve ser importado em código server-side
// (API routes, Server Components, Server Actions)
// NUNCA importe em Client Components ('use client')
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const serviceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
if (!supabaseUrl || !serviceRoleKey) {
throw new Error(
"Missing SUPABASE_SERVICE_ROLE_KEY environment variable. " +
"This is required for admin operations.",
);
}
// Cliente Supabase Admin para operações privilegiadas (apenas server-side)
export const supabaseAdmin = createClient(supabaseUrl, serviceRoleKey, {
auth: {
autoRefreshToken: false,
persistSession: false,
},
});