ConfigService
class ConfigService<K = Record<string, unknown>, WasValidated extends boolean = false> {
changes$
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>
set<T = any>(propertyPath: KeyOf<K>, value: T): void
setEnvFilePaths(paths: string[]): void
}
Properties
| Property | Description |
|---|---|
changes$
|
Read-only.
Returns a stream of configuration changes. Each event contains the attribute path, the old value and the new value. |
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
|
set() |
|---|
|
Sets a configuration value based on property path. |
setEnvFilePaths() | ||||||
|---|---|---|---|---|---|---|
|
Sets env file paths from |
||||||
Parameters
Returns
|