forked from akai/readest
eec2c39f19
* initial files * added testing files * removed unused files * cleaned additional mounts * fixed sql init * removed more unused files * moved to docker folder * revert package.json * gitignore update * env example comments and compose necessary healthcheck * ghcr package impl * updated dockerfile steps for layer caching * added development-stage to dockerfile to dev environment * added documentation on how to use dockerfile and compose.yml * fixed prettier issues * fixed image tag * removed workflow for later
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { createClient } from '@supabase/supabase-js';
|
|
|
|
const supabaseUrl =
|
|
process.env['SUPABASE_URL'] ||
|
|
process.env['NEXT_PUBLIC_SUPABASE_URL'] ||
|
|
atob(process.env['NEXT_PUBLIC_DEFAULT_SUPABASE_URL_BASE64']!);
|
|
const supabaseAnonKey =
|
|
process.env['SUPABASE_ANON_KEY'] ||
|
|
process.env['NEXT_PUBLIC_SUPABASE_ANON_KEY'] ||
|
|
atob(process.env['NEXT_PUBLIC_DEFAULT_SUPABASE_KEY_BASE64']!);
|
|
|
|
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
|
|
|
export const createSupabaseClient = (accessToken?: string) => {
|
|
return createClient(supabaseUrl, supabaseAnonKey, {
|
|
global: {
|
|
headers: accessToken
|
|
? {
|
|
Authorization: `Bearer ${accessToken}`,
|
|
}
|
|
: {},
|
|
},
|
|
});
|
|
};
|
|
|
|
export const createSupabaseAdminClient = () => {
|
|
const supabaseAdminKey = process.env['SUPABASE_ADMIN_KEY'] || '';
|
|
return createClient(supabaseUrl, supabaseAdminKey, {
|
|
auth: {
|
|
persistSession: false,
|
|
autoRefreshToken: false,
|
|
detectSessionInUrl: false,
|
|
},
|
|
});
|
|
};
|