MemoryConfigReader class

Config reader that stores configuration in memory.

The reader supports parameterization using Handlebars template engine: Handlebars

Configuration parameters

The configuration parameters are the configuration template

See IConfigReader

Example

var config = ConfigParams.fromTuples([
    'connection.host', '{{SERVICE_HOST}}',
    'connection.port', '{{SERVICE_PORT}}{{^SERVICE_PORT}}8080{{/SERVICE_PORT}}'
]);

var configReader = new MemoryConfigReader();
configReader.configure(config);

var parameters = ConfigParams.fromValue(process.env);

var config = await configReader.readConfig('123', parameters)
    // Possible result: connection.host=10.1.1.100;connection.port=8080
Implemented types

Constructors

MemoryConfigReader([ConfigParams? config])
Creates a new instance of config reader.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addChangeListener(INotifiable listener) → void
Adds a listener that will be notified when configuration is changed
override
configure(ConfigParams config) → void
Configures component by passing configuration parameters.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readConfig(String? correlationId, ConfigParams? parameters) Future<ConfigParams>
Reads configuration and parameterize it with given values.
override
removeChangeListener(INotifiable listener) → void
Remove a previously added change listener.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited