Skip to content

Commit

Permalink
feat(env): add client t3 env validation
Browse files Browse the repository at this point in the history
Validates client-side env variables
  • Loading branch information
rikhall1515 committed Apr 18, 2024
1 parent d1a8370 commit 24de083
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions env/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";

export const env = createEnv({
isServer: typeof window === "undefined",
client: {
NEXT_PUBLIC_BASE_URL: z.string().url(),
NEXT_PUBLIC_SITE_NAME: z.string(),
},
runtimeEnv: {
NEXT_PUBLIC_BASE_URL: process.env.NEXT_PUBLIC_BASE_URL,
NEXT_PUBLIC_SITE_NAME: process.env.NEXT_PUBLIC_SITE_NAME,
},
});

0 comments on commit 24de083

Please sign in to comment.