method IEnvironmentApi.validate
IEnvironmentApi.validate(spec: Readonly<Record<string, EnvVarSpec>>): void

Declares and validates environment variables.

Call this from IPlugin.register. The kernel validates every declared spec once, after all plugins have registered and before the init hooks run, so a spec declared later (e.g. from an onInit hook) is never checked.

Parameters

spec: Readonly<Record<string, EnvVarSpec>>

Variable specifications keyed by variable name

Return Type

void

Throws

Error

At startup when a required variable is missing or mistyped

Usage

import { type IEnvironmentApi } from "common/src/index.ts";