Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Latest commit

 

History

History
151 lines (88 loc) · 4.35 KB

INativeConfigAccess.md

File metadata and controls

151 lines (88 loc) · 4.35 KB

@js-soft/native-abstractions / Exports / INativeConfigAccess

Interface: 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.

Table of contents

Methods

Methods

get

get(key): Result<any, ApplicationError>

Read the value of the config associated to the key.

Parameters

Name Type
key string

Returns

Result<any, ApplicationError>

Defined in

src/INativeConfigAccess.ts:152


initDefaultConfig

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.

Parameters

Name Type Description
path string Path where the default config is fetched.

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeConfigAccess.ts:176


initRuntimeConfig

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.

Parameters

Name Type Description
path string Path where the runtime config is read from the filesystem.
logger ILogger -
fileAccess INativeFileAccess -

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeConfigAccess.ts:181


remove

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.

Parameters

Name Type
key string

Returns

Result<void, ApplicationError>

Defined in

src/INativeConfigAccess.ts:165


save

save(): Promise<Result<void, ApplicationError>>

Save the runtime config on the filesystem. A ConfigurationSaveEvent is published on the INativeEventBus after the value was changed.

Returns

Promise<Result<void, ApplicationError>>

Defined in

src/INativeConfigAccess.ts:170


set

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.

Parameters

Name Type
key string
value any

Returns

Result<void, ApplicationError>

Defined in

src/INativeConfigAccess.ts:159