Skip to content

Commit

Permalink
Update Next.js example code snippets (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresmarpz authored Jul 22, 2024
1 parent 5975abe commit edd7cc5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docs/src/app/docs/nextjs/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ export const env = createEnv({
DATABASE_URL: z.string().url(),
OPEN_AI_API_KEY: z.string().min(1),
},
runtimeEnv: process.env,
// If you're using Next.js < 13.4.4, you'll need to specify the runtimeEnv manually
// runtimeEnv: {
// DATABASE_URL: process.env.DATABASE_URL,
// OPEN_AI_API_KEY: process.env.OPEN_AI_API_KEY,
// },
// For Next.js >= 13.4.4, you can just reference process.env:
experimental__runtimeEnv: process.env
});
```

Expand All @@ -89,9 +95,11 @@ import { z } from "zod";

export const env = createEnv({
client: {
PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().min(1),
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().min(1),
},
runtimeEnv: {
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,
},
runtimeEnv: process.env,
});
```

Expand Down

0 comments on commit edd7cc5

Please sign in to comment.