aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Database/sb.server.ts
blob: 47205827e0caeef37db21eefa47e38a68e5bbf42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { createClient } from "@supabase/supabase-js";
import { env } from "$env/dynamic/private";

const supabaseUrl = env.SUPABASE_URL;
const supabaseKey = env.SUPABASE_SERVICE_ROLE_KEY || env.SUPABASE_ANON_KEY;

if (!supabaseUrl || !supabaseKey)
	throw new Error("Supabase credentials are required.");

const sb = createClient(supabaseUrl, supabaseKey, {
	auth: {
		autoRefreshToken: false,
		persistSession: false,
	},
});

export default sb;