feat: add environment variables more consistently

This commit is contained in:
Bart van der Braak 2023-06-15 01:36:30 +02:00
parent 2970033193
commit 97a3051563
2 changed files with 19 additions and 0 deletions

4
.env.example Normal file
View file

@ -0,0 +1,4 @@
# -----------------------------------------------------------------------------
# App
# -----------------------------------------------------------------------------
NEXT_PUBLIC_APP_URL=http://localhost:3000

15
env.mjs Normal file
View file

@ -0,0 +1,15 @@
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";
export const env = createEnv({
server: {
// This is optional because it's only used in development.
// See https://next-auth.js.org/deployment.
},
client: {
NEXT_PUBLIC_APP_URL: z.string().min(1),
},
runtimeEnv: {
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
},
});