t3-oss / t3-env

https://env.t3.gg
MIT License
2.67k stars 86 forks source link

added a preset for a supabase #234

Closed Boby900 closed 4 months ago

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
t3-env ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 2:40pm
vercel[bot] commented 4 months ago

@Boby900 is attempting to deploy a commit to the t3-oss Team on Vercel.

A member of the Team first needs to authorize it.

juliusmarminge commented 4 months ago

Hey - I wasn't able to push to your branch, but could you move the variables to client and also move the preset to the nextjs package, since we're using nextjs variables here? Thanks 🙏

// packages/next/src/preset.ts
import { z } from "zod";
import { createEnv } from ".";

export * from "@t3-oss/env-core/presets";

/**
 * Supabase Environment Variables
 *   @see https://supabase.com/docs/guides/getting-started/quickstarts/nextjs
 */
export const supabase = () =>
    createEnv({
      client: {
        NEXT_PUBLIC_SUPABASE_URL: z.string().optional(),
        NEXT_PUBLIC_SUPABASE_ANON_KEY: z.string().optional(),
      },
      runtimeEnv: {
        NEXT_PUBLIC_SUPABASE_ANON_KEY: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
        NEXT_PUBLIC_SUPABASE_URL: process.env.SUPABASE_ANON_KEY,
      },
    });