mission-control/lib/supabase/client.ts
OpenClaw Bot 762c59500e Mission Control Phase 2: Transform Tasks page to overview
- Replaced kanban with task overview/summary view
- Added task stats cards (total, in progress, high priority, overdue)
- Added recent activity sections (updated, completed, high priority)
- Added quick action links to gantt-board
- Created lib/data/tasks.ts with data fetching functions
- Removed file-based storage (taskDb.ts, api/tasks/route.ts)
- Connected to gantt-board Supabase for real data
2026-02-21 22:48:15 -06:00

30 lines
1.0 KiB
TypeScript

import { createClient } from "@supabase/supabase-js";
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
const supabaseServiceKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
if (!supabaseUrl || !supabaseAnonKey) {
throw new Error("Missing Supabase environment variables");
}
const requiredSupabaseUrl = supabaseUrl as string;
const requiredSupabaseAnonKey = supabaseAnonKey as string;
// Client for browser/client-side use (uses anon key)
export const supabase = createClient(requiredSupabaseUrl, requiredSupabaseAnonKey);
// Admin client for server-side operations (uses service role key)
// This bypasses RLS and should only be used in server contexts
export function getServiceSupabase() {
if (!supabaseServiceKey) {
throw new Error("SUPABASE_SERVICE_ROLE_KEY is not set");
}
return createClient(requiredSupabaseUrl, supabaseServiceKey as string, {
auth: {
autoRefreshToken: false,
persistSession: false,
},
});
}