Files
kunstenkamp/packages/env/src/server.ts
zias 3c439649f9 feat:add registration management with token-based access
Add management tokens to registrations allowing users to view, edit, and
cancel their registration via a unique URL. Implement email
notifications
for confirmations, updates, and cancellations using nodemailer. Simplify
art forms grid from 6 to 4 items and remove trajectory links. Translate
footer links to Dutch and fix matzah spelling in info section.
2026-03-03 08:54:33 +01:00

31 lines
960 B
TypeScript

import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { createEnv } from "@t3-oss/env-core";
import { config } from "dotenv";
import { z } from "zod";
// Only load .env file in development (not in Cloudflare Workers)
if (process.env.NODE_ENV !== "production") {
const __dirname = dirname(fileURLToPath(import.meta.url));
config({ path: resolve(__dirname, "../.env") });
}
export const env = createEnv({
server: {
DATABASE_URL: z.string().min(1),
BETTER_AUTH_SECRET: z.string().min(32),
BETTER_AUTH_URL: z.url(),
CORS_ORIGIN: z.url(),
SMTP_HOST: z.string().min(1).optional(),
SMTP_PORT: z.coerce.number().default(587),
SMTP_USER: z.string().min(1).optional(),
SMTP_PASS: z.string().min(1).optional(),
SMTP_FROM: z.string().min(1).optional(),
NODE_ENV: z
.enum(["development", "production", "test"])
.default("development"),
},
runtimeEnv: process.env,
emptyStringAsUndefined: true,
});