ConfigReader

Abstract config reader that supports configuration parameterization.

Implements: IConfigurable, IConfigReader

Description

The ConfigReader class allows you to create config readers that support configuration parameterization.

Configuration parameters

  • parameters: this entire section is used as template parameters

Instance methods

addChangeListener

Adds a listener that will be notified when configuration is changed

public addChangeListener(listener: INotifiable): void

configure

Configures component by passing configuration parameters.

public configure(config: ConfigParams): void

  • config: ConfigParams - configuration parameters to be set.

parameterize

Parameterized configuration template given as string with dynamic parameters.

protected parameterize(config: string, parameters: ConfigParams): string

  • config: string - a string with configuration template to be parameterized
  • parameters: ConfigParams - dynamic parameters to inject into the template
  • returns: string - a parameterized configuration string.

removeChangeListener

Remove a previously added change listener.

public removeChangeListener(listener: INotifiable): void

Abstract methods

readConfig

Reads configuration and parameterizes it with given values.

public abstract readConfig(correlationId: string, parameters: ConfigParams) Promise<ConfigParams>

  • correlationId: string - (optional) transaction id to trace execution through call chain.
  • parameters: ConfigParams - values to parameters of the configuration or null to skip parameterization.
  • returns: Promise<ConfigParams> - ConfigParams configuration.

See also