import "server-only"
import { getSupabaseUrl } from "@/lib/supabase/env"

export function getSupabaseServiceRoleKey() {
  const value = process.env.SUPABASE_SERVICE_ROLE_KEY
  if (typeof value === "string" && value.trim().length > 0) return value
  throw new Error("Falta configurar SUPABASE_SERVICE_ROLE_KEY")
}

export function getSupabaseAdminEnv() {
  return {
    url: getSupabaseUrl(),
    serviceRoleKey: getSupabaseServiceRoleKey(),
  }
}
