Version 3 of the kit: - Radix UI replaced with Base UI (using the Shadcn UI patterns) - next-intl replaces react-i18next - enhanceAction deprecated; usage moved to next-safe-action - main layout now wrapped with [locale] path segment - Teams only mode - Layout updates - Zod v4 - Next.js 16.2 - Typescript 6 - All other dependencies updated - Removed deprecated Edge CSRF - Dynamic Github Action runner
33 lines
920 B
TypeScript
33 lines
920 B
TypeScript
import 'server-only';
|
|
import * as z from 'zod';
|
|
|
|
const message =
|
|
'Invalid Supabase Secret Key. Please add the environment variable SUPABASE_SECRET_KEY.';
|
|
|
|
/**
|
|
* @name getSupabaseSecretKey
|
|
* @description Get the Supabase Service Role Key.
|
|
* ONLY USE IN SERVER-SIDE CODE. DO NOT EXPOSE THIS TO CLIENT-SIDE CODE.
|
|
*/
|
|
export function getSupabaseSecretKey() {
|
|
return z
|
|
.string({
|
|
error: message,
|
|
})
|
|
.min(1, {
|
|
message: message,
|
|
})
|
|
.parse(process.env.SUPABASE_SECRET_KEY);
|
|
}
|
|
|
|
/**
|
|
* Displays a warning message if the Supabase Service Role is being used.
|
|
*/
|
|
export function warnServiceRoleKeyUsage() {
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
console.warn(
|
|
`[Dev Only] This is a simple warning to let you know you are using the Supabase Secret Key. This key bypasses RLS and should only be used in server-side code. Please make sure it's the intended usage.`,
|
|
);
|
|
}
|
|
}
|