Config reader that stores a configuration in memory.

Implements: IConfigReader, IReconfigurable


The MemoryConfigReader class allows you to create a config reader that stores a configuration in memory.

Configuration parameters

The configuration parameters are the configuration template

  • path: path to the configuration file
  • parameters: this entire section is used as template parameters


Creates a new instance of a config reader.

public constructor(config: ConfigParams = null)

  • config: ConfigParams - (optional) component configuration parameters

Instance methods


Adds a listener that will be notified when configuration is changed

public addChangeListener(listener: INotifiable): void


Configures a component by passing its configuration parameters.

public configure(config: ConfigParams): void

  • config: ConfigParams - configuration parameters to be set.


Reads a configuration and parameterizes it with given values.

public readConfig(correlationId: string, parameters: ConfigParams): ConfigParams

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


Remove a previously added change listener.

public removeChangeListener(listener: INotifiable): void


let config = ConfigParams.fromTuples(
    "", "{{SERVICE_HOST}}",
    "connection.port", "{{SERVICE_PORT}}{{^SERVICE_PORT}}8080{{/SERVICE_PORT}}"
let configReader = new MemoryConfigReader();
let parameters = ConfigParams.fromValue(process.env);
let config = await configReader.readConfig("123", parameters);
// Possible result:;connection.port=8080