Skip to main content

Class: DefaultConfigStore


PURISTA API / Modules / @purista/core / DefaultConfigStore

Class: DefaultConfigStore

@purista/core.DefaultConfigStore

The DefaultConfigStore is a placeholder which offers all needed methods. Getters and setters will throw a UnhandledError with status Unauthorized, when a disabled operation is called.

For development and testing purpose, you can initiate the store with values.

Example

const store = new DefaultConfigStore({
   enableGet: true,
   enableRemove: true,
   enableSet: true,
   config: {
     initialValue: 'initial',
   },
})

console.log(await store.getConfig('initialValue') // outputs: { initialValue: 'initial' }

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DefaultConfigStore(config?): DefaultConfigStore

Parameters

NameTypeDescription
config?Object-
config.cacheTtl?numberCache time to live in ms
config.enableCache?booleanEnable cache
config.enableGet?booleanEnable generally get method
config.enableRemove?booleanEnable generally remove method
config.enableSet?booleanEnable generally set method
config.logLevel?LogLevelNameA log level for new logger if logger is not set
config.logger?LoggerA logger instance

Returns

DefaultConfigStore

Overrides

ConfigStoreBaseClass.constructor

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:27open in new window

Properties

config

config: Object

Type declaration

NameTypeDescription
cacheTtl?numberCache time to live in ms
enableCache?booleanEnable cache
enableGet?booleanEnable generally get method
enableRemove?booleanEnable generally remove method
enableSet?booleanEnable generally set method
logLevel?LogLevelNameA log level for new logger if logger is not set
logger?LoggerA logger instance

Inherited from

ConfigStoreBaseClass.config

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:13open in new window


logger

logger: Logger

Inherited from

ConfigStoreBaseClass.logger

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:12open in new window


map

Private map: Map<string, unknown>

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:26open in new window


name

name: string

name of store

Inherited from

ConfigStoreBaseClass.name

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:15open in new window

Methods

destroy

destroy(): Promise<void>

disconnects and shuts down the config store

Returns

Promise<void>

Inherited from

ConfigStoreBaseClass.destroy

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:67open in new window


getConfig

getConfig(...configNames): Promise<Record<string, unknown>>

Parameters

NameType
...configNamesstring[]

Returns

Promise<Record<string, unknown>>

Overrides

ConfigStoreBaseClass.getConfig

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:39open in new window


removeConfig

removeConfig(configName): Promise<void>

Parameters

NameType
configNamestring

Returns

Promise<void>

Overrides

ConfigStoreBaseClass.removeConfig

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:59open in new window


setConfig

setConfig(configName, configValue): Promise<void>

Parameters

NameType
configNamestring
configValueunknown

Returns

Promise<void>

Overrides

ConfigStoreBaseClass.setConfig

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:51open in new window

Last update:
Contributors: Sebastian Wessel