Skip to main content

getAppConfigValue()

function getAppConfigValue<Type>(key?: string, defaultValue?: unknown): Type;

Gets a value from the application configuration using dot notation. Returns a deep clone to prevent accidental mutations.

Type Parameters

Type

Type

Expected return type

Parameters

key?

string = ''

Dot-notation path to the config value (e.g., 'serviceEndpoints.api')

defaultValue?

unknown = null

Value to return if key doesn't exist (default: null)

Returns

Type

The configuration value or default

Example

const apiUrl = getAppConfigValue<string>('serviceEndpoints.api', 'https://default.com');
const timeout = getAppConfigValue<number>('requestTimeout', 30000);