ConfigService
class ConfigService<K = Record<string, unknown>, WasValidated extends boolean = false> {
get<T = any>(propertyPath: KeyOf<K>, defaultValueOrOptions?: ConfigGetOptions | T, options?: ConfigGetOptions): T | undefined
getOrThrow<T = any>(propertyPath: KeyOf<K>, defaultValueOrOptions?: ConfigGetOptions | T, options?: ConfigGetOptions): Exclude<T, undefined>
}
Methods
get() | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Get a configuration value (either custom configuration or process environment variable) based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). It returns a default value if the key does not exist. |
||||||||||||||||||||||||||||||||||||
4 overloads...Show All Hide All expand_moreOverload #1Get a configuration value (either custom configuration or process environment variable) based on property path (you can use dot notation to traverse nested object, e.g. "database.host").
Parameters
Returns
Overload #2Get a configuration value (either custom configuration or process environment variable) based on property path (you can use dot notation to traverse nested object, e.g. "database.host").
Parameters
Returns
Overload #3
Parameters
Returns
Overload #4
Parameters
Returns
|
getOrThrow() | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Get a configuration value (either custom configuration or process environment variable) based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). It returns a default value if the key does not exist. If the default value is undefined an exception will be thrown. |
||||||||||||||||||||||||||||||||||||
4 overloads...Show All Hide All expand_moreOverload #1Get a configuration value (either custom configuration or process environment variable) based on property path (you can use dot notation to traverse nested object, e.g. "database.host").
Parameters
Returns
Overload #2Get a configuration value (either custom configuration or process environment variable) based on property path (you can use dot notation to traverse nested object, e.g. "database.host").
Parameters
Returns
Overload #3
Parameters
Returns
Overload #4
Parameters
Returns
|