Files
klz-cables.com/lib/env.ts
Marc Mintel 51043da882
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Has been cancelled
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(types): wrap mintelEnvSchema in z.object() to fix extend error
2026-02-11 00:50:28 +01:00

43 lines
1.1 KiB
TypeScript

import { z } from 'zod';
import { validateMintelEnv, mintelEnvSchema } from '@mintel/next-utils';
/**
* Environment variable schema.
* Extends the default Mintel environment schema.
*/
const envExtension = {
// Project specific overrides or additions
AUTH_COOKIE_NAME: z.string().default('klz_gatekeeper_session'),
// Gatekeeper specifics not in base
GATEKEEPER_URL: z.string().url().default('http://gatekeeper:3000'),
GATEKEEPER_BYPASS_ENABLED: z.preprocess(
(val) => val === 'true' || val === true,
z.boolean().default(false),
),
NEXT_PUBLIC_FEEDBACK_ENABLED: z.preprocess(
(val) => val === 'true' || val === true,
z.boolean().default(false),
),
INFRA_DIRECTUS_URL: z.string().url().optional(),
INFRA_DIRECTUS_TOKEN: z.string().optional(),
};
/**
* Full schema including Mintel base
*/
export const envSchema = z.object(mintelEnvSchema).extend(envExtension);
/**
* Validated environment object.
*/
export const env = validateMintelEnv(envExtension);
/**
* For legacy compatibility with existing code.
*/
export function getRawEnv() {
return env;
}