All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 37s
Build & Deploy / 🧪 QA (push) Successful in 1m36s
Build & Deploy / 🏗️ Build (push) Successful in 4m0s
Build & Deploy / 🚀 Deploy (push) Successful in 30s
Build & Deploy / 🧪 Smoke Test (push) Successful in 42s
Build & Deploy / 🔔 Notify (push) Successful in 1s
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import { z } from 'zod';
|
|
import { validateMintelEnv, mintelEnvSchema, withMintelRefinements } 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(),
|
|
|
|
// Analytics
|
|
UMAMI_WEBSITE_ID: z.string().optional(),
|
|
UMAMI_API_ENDPOINT: z.string().optional(),
|
|
|
|
// Mail Configuration
|
|
MAIL_HOST: z.string().optional(),
|
|
MAIL_PORT: z.coerce.number().optional(),
|
|
MAIL_USERNAME: z.string().optional(),
|
|
MAIL_PASSWORD: z.string().optional(),
|
|
MAIL_FROM: z.string().optional(),
|
|
MAIL_RECIPIENTS: z.string().optional(),
|
|
|
|
// Directus Authentication
|
|
DIRECTUS_URL: z.string().url().optional(),
|
|
DIRECTUS_ADMIN_EMAIL: z.string().email().optional(),
|
|
DIRECTUS_ADMIN_PASSWORD: z.string().optional(),
|
|
DIRECTUS_API_TOKEN: z.string().optional(),
|
|
};
|
|
|
|
/**
|
|
* Full schema including Mintel base and refinements
|
|
*/
|
|
export const envSchema = withMintelRefinements(z.object(mintelEnvSchema).extend(envExtension));
|
|
|
|
/**
|
|
* Validated environment object.
|
|
*/
|
|
export const env = validateMintelEnv(envExtension);
|
|
|
|
/**
|
|
* For legacy compatibility with existing code.
|
|
*/
|
|
export function getRawEnv() {
|
|
return env;
|
|
}
|