Files
klz-cables.com/lib/env.ts
Marc Mintel f15957847c
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Failing after 13s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Successful in 1s
Build & Deploy / 🚀 Deploy (push) Has been skipped
refactor: finalize type-safe env and config using @mintel/next-utils 1.7.8
2026-02-11 00:39:59 +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 which already includes:
* - Directus (URL, TOKEN, INTERNAL_URL, etc.)
* - Mail (HOST, PORT, etc.)
* - Gotify
* - Logging
* - Analytics
*/
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(),
};
/**
* Validated environment object.
*/
export const env = validateMintelEnv(envExtension);
/**
* For legacy compatibility with existing code.
*/
export function getRawEnv() {
return env;
}