Skip to main content

Function: loadConfig()

loadConfig<S>(options): Promise<LoadedConfig<StaticType<[], "Encode", { }, { }, S>>>

Defined in: packages/config/src/load.ts:97

Reads, merges, validates and resolves configuration, once, before anything is constructed.

Order: defaults, then the YAML file, then environment overrides, then derive fills what is still unset. The result is validated against the schema (unknown keys refused), the secret driver is checked against the environment class, and only then are secret references resolved. Every problem found at a stage is reported together.

Does not read any variable outside <envPrefix>__* and <envPrefix>_CONFIG_FILE. Does not cache or watch: configuration is fixed for the life of the process.

Type Parameters​

S​

S extends TObject<TProperties>

Parameters​

options​

LoadConfigOptions<S>

Returns​

Promise<LoadedConfig<StaticType<[], "Encode", { }, { }, S>>>

Throws​

Naming each failing key. Never contains a value.