refactor: standardize env and directus logic using enhanced @mintel/next-utils
Some checks failed
Some checks failed
This commit is contained in:
21
lib/env.ts
21
lib/env.ts
@@ -3,20 +3,20 @@ import { validateMintelEnv, mintelEnvSchema } from '@mintel/next-utils';
|
||||
|
||||
/**
|
||||
* Environment variable schema.
|
||||
* Extends the default Mintel environment 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 variables
|
||||
NEXT_PUBLIC_TARGET: z.enum(['development', 'testing', 'staging', 'production']).optional(),
|
||||
TARGET: z.enum(['development', 'testing', 'staging', 'production']).optional(),
|
||||
|
||||
// Directus (Extended from base)
|
||||
INTERNAL_DIRECTUS_URL: z.string().url().optional(),
|
||||
INFRA_DIRECTUS_URL: z.string().url().optional(),
|
||||
INFRA_DIRECTUS_TOKEN: z.string().optional(),
|
||||
// Project specific overrides or additions
|
||||
AUTH_COOKIE_NAME: z.string().default('klz_gatekeeper_session'),
|
||||
|
||||
// Gatekeeper
|
||||
// Gatekeeper specifics not in base
|
||||
GATEKEEPER_URL: z.string().url().default('http://gatekeeper:3000'),
|
||||
GATEKEEPER_BYPASS_ENABLED: z.preprocess(
|
||||
(val) => val === 'true' || val === true,
|
||||
@@ -26,6 +26,9 @@ export const envSchema = z.object({
|
||||
(val) => val === 'true' || val === true,
|
||||
z.boolean().default(false),
|
||||
),
|
||||
|
||||
INFRA_DIRECTUS_URL: z.string().url().optional(),
|
||||
INFRA_DIRECTUS_TOKEN: z.string().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user