Initial commit

This commit is contained in:
OpenCode Test
2025-12-24 10:50:10 -08:00
commit e1a64aa092
70 changed files with 5827 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
import { z } from "zod";
const envSchema = z.object({
APP_NAME: z.string().min(1).default("porthole"),
NEXT_PUBLIC_APP_NAME: z.string().min(1).optional()
});
let cachedEnv: z.infer<typeof envSchema> | undefined;
export function getEnv() {
if (cachedEnv) return cachedEnv;
const parsed = envSchema.safeParse(process.env);
if (!parsed.success) {
throw new Error(`Invalid environment variables: ${parsed.error.message}`);
}
cachedEnv = parsed.data;
return cachedEnv;
}
export function getAppName() {
const env = getEnv();
return env.NEXT_PUBLIC_APP_NAME ?? env.APP_NAME;
}