Files
mintel.me/apps/web/lib/env.ts
Marc Mintel e3120e3ff8
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 4s
Build & Deploy / 🏗️ Build (push) Failing after 3m15s
Build & Deploy / 🧪 QA (push) Failing after 4m42s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
refactor: standardize env and analytics using enhanced @mintel/next-utils
2026-02-10 23:47:26 +01:00

35 lines
909 B
TypeScript

import { z } from "zod";
import { validateMintelEnv, mintelEnvSchema } from "@mintel/next-utils";
/**
* Environment variable schema for the main website.
* Extends the default Mintel environment schema.
*/
export const envSchema = z.object({
...mintelEnvSchema,
// Project specific overrides or additions
AUTH_COOKIE_NAME: z.string().default("mintel_gatekeeper_session"),
// Analytics provider toggle
NEXT_PUBLIC_ANALYTICS_PROVIDER: z
.enum(["plausible", "umami"])
.default("plausible"),
// Plausible specifics (to be standardized later if needed)
NEXT_PUBLIC_PLAUSIBLE_DOMAIN: z.string().default("mintel.me"),
NEXT_PUBLIC_PLAUSIBLE_SCRIPT_URL: z.string().url().optional(),
});
/**
* Validated environment object.
*/
export const env = validateMintelEnv(envSchema.shape);
/**
* For legacy compatibility with existing code.
*/
export function getRawEnv() {
return env;
}