Skip to content

Class: ConfigBoundService<T>

Defined in: packages/nestjs/src/config-bound.service.ts:17

Injectable service that provides type-safe access to ConfigBound configuration. Wraps a ConfigBound instance and exposes all configuration operations for use in NestJS controllers and services.

Type Parameters

Type ParameterDefault type
T extends ConfigSchemaConfigSchema

Constructors

Constructor

ts
new ConfigBoundService<T>(configBound): ConfigBoundService<T>;

Defined in: packages/nestjs/src/config-bound.service.ts:18

Parameters

ParameterType
configBoundConfigBound<T>

Returns

ConfigBoundService<T>

Accessors

binds

Get Signature

ts
get binds(): readonly Bind[];

Defined in: packages/nestjs/src/config-bound.service.ts:31

Returns

readonly Bind[]


name

Get Signature

ts
get name(): string;

Defined in: packages/nestjs/src/config-bound.service.ts:27

Returns

string


sections

Get Signature

ts
get sections(): readonly Section[];

Defined in: packages/nestjs/src/config-bound.service.ts:35

Returns

readonly Section[]

Methods

addBind()

ts
addBind(bind): void;

Defined in: packages/nestjs/src/config-bound.service.ts:39

Parameters

ParameterType
bindBind

Returns

void


addSection()

ts
addSection(section): void;

Defined in: packages/nestjs/src/config-bound.service.ts:43

Parameters

ParameterType
sectionSection

Returns

void


get()

ts
get<K, E>(sectionName, elementName): Promise<
  | InferConfigType<T>[K][E]
| undefined>;

Defined in: packages/nestjs/src/config-bound.service.ts:51

Type Parameters

Type Parameter
K extends string
E extends string

Parameters

ParameterType
sectionNameK
elementNameE

Returns

Promise< | InferConfigType<T>[K][E] | undefined>


getConfigBound()

ts
getConfigBound(): ConfigBound<T>;

Defined in: packages/nestjs/src/config-bound.service.ts:23

Returns

ConfigBound<T>


getFromCache()

ts
getFromCache<K, E>(sectionName, elementName): 
  | InferConfigType<T>[K][E]
  | undefined;

Defined in: packages/nestjs/src/config-bound.service.ts:72

Reads a configuration value from the in-memory cache only.

Type Parameters

Type Parameter
K extends string
E extends string

Parameters

ParameterTypeDescription
sectionNameKSection containing the requested element.
elementNameEElement name to read from cache.

Returns

| InferConfigType<T>[K][E] | undefined

Cached value when present; otherwise undefined.


getOrThrow()

ts
getOrThrow<K, E>(sectionName, elementName): Promise<InferConfigType<T>[K][E]>;

Defined in: packages/nestjs/src/config-bound.service.ts:58

Type Parameters

Type Parameter
K extends string
E extends string

Parameters

ParameterType
sectionNameK
elementNameE

Returns

Promise<InferConfigType<T>[K][E]>


getOrThrowFromCache()

ts
getOrThrowFromCache<K, E>(sectionName, elementName): InferConfigType<T>[K][E];

Defined in: packages/nestjs/src/config-bound.service.ts:86

Reads a configuration value from cache and throws when it is undefined.

Type Parameters

Type Parameter
K extends string
E extends string

Parameters

ParameterTypeDescription
sectionNameKSection containing the requested element.
elementNameEElement name to read from cache.

Returns

InferConfigType<T>[K][E]

Cached value.


getSections()

ts
getSections(): readonly Section[];

Defined in: packages/nestjs/src/config-bound.service.ts:47

Returns

readonly Section[]


getValidationErrors()

ts
getValidationErrors(): Promise<object[]>;

Defined in: packages/nestjs/src/config-bound.service.ts:115

Returns

Promise<object[]>


isCacheReady()

ts
isCacheReady(): boolean;

Defined in: packages/nestjs/src/config-bound.service.ts:107

Indicates whether cached reads are currently available.

Returns

boolean

true when cache population has completed.


populateCache()

ts
populateCache(options?): Promise<void>;

Defined in: packages/nestjs/src/config-bound.service.ts:98

Populates the cache for all configured elements.

Parameters

ParameterTypeDescription
options?CacheRefreshOptionsCache population behavior options.

Returns

Promise<void>


validate()

ts
validate(): Promise<void>;

Defined in: packages/nestjs/src/config-bound.service.ts:111

Returns

Promise<void>