* MED-151: add profile view and working smoking dashboard card * update zod * move some components to shared * move some components to shared * remove console.logs * remove unused password form components * only check null for variant * use pathsconfig
25 lines
837 B
TypeScript
25 lines
837 B
TypeScript
import { z } from 'zod';
|
|
|
|
/**
|
|
* Returns and validates the Supabase client keys from the environment.
|
|
*/
|
|
export function getSupabaseClientKeys() {
|
|
return z
|
|
.object({
|
|
url: z.string({
|
|
error: `Please provide the variable NEXT_PUBLIC_SUPABASE_URL`,
|
|
})
|
|
.describe(`This is the URL of your hosted Supabase instance. Please provide the variable NEXT_PUBLIC_SUPABASE_URL.`),
|
|
anonKey: z
|
|
.string({
|
|
error: `Please provide the variable NEXT_PUBLIC_SUPABASE_ANON_KEY`,
|
|
})
|
|
.describe(`This is the anon key provided by Supabase. It is a public key used client-side. Please provide the variable NEXT_PUBLIC_SUPABASE_ANON_KEY.`)
|
|
.min(1),
|
|
})
|
|
.parse({
|
|
url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
|
anonKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
|
|
});
|
|
}
|