Files
mb-grid-solutions.com/lib/env.ts
Marc Mintel 8ff4503270
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 4s
Build & Deploy / 🧪 QA (push) Failing after 1m30s
Build & Deploy / 🏗️ Build (push) Failing after 1m51s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 3s
refactor: standardize env and directus logic using enhanced @mintel/next-utils
2026-02-10 23:47:18 +01:00

34 lines
800 B
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
*/
export const envSchema = z.object({
...mintelEnvSchema,
// Project specific overrides or additions
AUTH_COOKIE_NAME: z.string().default("mb_gatekeeper_session"),
INFRA_DIRECTUS_URL: z.string().url().optional(),
INFRA_DIRECTUS_TOKEN: z.string().optional(),
});
/**
* Validated environment object.
*/
export const env = validateMintelEnv(envSchema.shape);
/**
* For legacy compatibility with existing code.
*/
export function getRawEnv() {
return env;
}