@js-soft/native-abstractions / Exports / INativeConfigAccess
Management of default and runtime config. The default config is created during development and delivered as part of the application. The runtime config is created by the applocation during execution. Default and runtime config are merged to a single config object which can be accessed through the get method. The default config is read-only. However, values of the runtime config can "overlay" the default config.
▸ get(key
): Result
<any
, ApplicationError
>
Read the value of the config associated to the key.
Name | Type |
---|---|
key |
string |
Result
<any
, ApplicationError
>
src/INativeConfigAccess.ts:152
▸ initDefaultConfig(path
): Promise
<Result
<void
, ApplicationError
>>
Initialization of the config module without the requirement of a filesystem. It loads the default config while keeping the runtime config empty.
Name | Type | Description |
---|---|---|
path |
string |
Path where the default config is fetched. |
Promise
<Result
<void
, ApplicationError
>>
src/INativeConfigAccess.ts:176
▸ initRuntimeConfig(path
, logger
, fileAccess
): Promise
<Result
<void
, ApplicationError
>>
Initialization of the runtime config in addition to the default config with the requirement of a filesystem.
Name | Type | Description |
---|---|---|
path |
string |
Path where the runtime config is read from the filesystem. |
logger |
ILogger |
- |
fileAccess |
INativeFileAccess |
- |
Promise
<Result
<void
, ApplicationError
>>
src/INativeConfigAccess.ts:181
▸ remove(key
): Result
<void
, ApplicationError
>
Remove a key-value pair from the runtime config. A ConfigurationRemoveEvent is published on the INativeEventBus after the value was changed.
Name | Type |
---|---|
key |
string |
Result
<void
, ApplicationError
>
src/INativeConfigAccess.ts:165
▸ save(): Promise
<Result
<void
, ApplicationError
>>
Save the runtime config on the filesystem. A ConfigurationSaveEvent is published on the INativeEventBus after the value was changed.
Promise
<Result
<void
, ApplicationError
>>
src/INativeConfigAccess.ts:170
▸ set(key
, value
): Result
<void
, ApplicationError
>
Change or add a value of/to the runtime config - in memory. To persist the change onto the filesystem, call save. A ConfigurationSetEvent is published on the INativeEventBus after the value was changed.
Name | Type |
---|---|
key |
string |
value |
any |
Result
<void
, ApplicationError
>