Some checks failed
🚀 Build & Deploy / 🔍 Prepare (push) Successful in 4s
🚀 Build & Deploy / 🧪 QA (push) Successful in 1m43s
🚀 Build & Deploy / 🏗️ Build (push) Successful in 12m3s
🚀 Build & Deploy / 🚀 Deploy (push) Failing after 1m21s
🚀 Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
🚀 Build & Deploy / 🔔 Notify (push) Successful in 1s
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { z } from "zod";
|
|
import {
|
|
validateMintelEnv,
|
|
mintelEnvSchema,
|
|
withMintelRefinements,
|
|
} 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("mb_gatekeeper_session"),
|
|
NEXT_PUBLIC_SENTRY_DSN: z.string().optional(),
|
|
SENTRY_DSN: z.string().optional(),
|
|
};
|
|
|
|
/**
|
|
* Full schema including Mintel base and refinements
|
|
*/
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
export const envSchema = withMintelRefinements(
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
(z as any).object(mintelEnvSchema).extend(envExtension) as any,
|
|
);
|
|
|
|
/**
|
|
* Validated environment object.
|
|
*/
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export const env = validateMintelEnv(envExtension) as any;
|
|
|
|
/**
|
|
* For legacy compatibility with existing code.
|
|
*/
|
|
export function getRawEnv() {
|
|
return env;
|
|
}
|