Skip to main content

Class: ConfigService

Service responsible for loading and providing access to application configuration. The configuration is loaded once at construction time via the injected loader.

Implements​

  • IConfigService

Constructors​

Constructor​

new ConfigService(loader): ConfigService

Creates an instance of ConfigService.

Parameters​

loader​

IConfigLoader

The platform-specific configuration loader. It should implement IConfigLoader.load() to return a map of config values.

Returns​

ConfigService

Methods​

get()​

get<T>(key, defaultValue?): T

Retrieves a configuration value by key, optionally casting it to the type of a default value.

Type Parameters​

T​

T = any

The expected return type.

Parameters​

key​

string

The configuration key to look up.

defaultValue?​

T

An optional default value to return if the key is not found.

Returns​

T

The configuration value cast to T, or the provided defaultValue.

Throws​

If the key is missing and no defaultValue is provided.

Implementation of​

IConfigService.get