fix: Tiny fixes in common package * Fix self-referencing and circular imports * Fix env isServer Approved-by: Joakim Jäderberg
30 lines
926 B
TypeScript
30 lines
926 B
TypeScript
import { createEnv } from "@t3-oss/env-nextjs"
|
|
import { z } from "zod"
|
|
|
|
export const env = createEnv({
|
|
/**
|
|
* Due to t3-env only checking typeof window === "undefined"
|
|
* and Netlify running Deno, window is never "undefined"
|
|
* https://github.com/t3-oss/t3-env/issues/154
|
|
*/
|
|
isServer: typeof window === "undefined" || "Deno" in window,
|
|
server: {
|
|
NODE_ENV: z.enum(["development", "test", "production"]),
|
|
REDIS_API_HOST: z.string().optional(),
|
|
REDIS_API_KEY: z.string().optional(),
|
|
BRANCH:
|
|
process.env.NODE_ENV !== "development"
|
|
? z.string()
|
|
: z.string().optional().default("dev"),
|
|
GIT_SHA: z.string().optional(),
|
|
},
|
|
emptyStringAsUndefined: true,
|
|
runtimeEnv: {
|
|
NODE_ENV: process.env.NODE_ENV,
|
|
REDIS_API_HOST: process.env.REDIS_API_HOST,
|
|
REDIS_API_KEY: process.env.REDIS_API_KEY,
|
|
BRANCH: process.env.BRANCH,
|
|
GIT_SHA: process.env.GIT_SHA,
|
|
},
|
|
})
|