ConfigReader

Abstract config reader that supports configuration parameterization.

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.

Constructors

NewConfigReader

Creates a new instance of the config reader.

NewConfigReader() *ConfigReader

Methods

AddChangeListener

Adds a listener that will be notified when configuration is changed

AddChangeListener(listener crun.INotifiable)

Configure

Configures a component by passing its configuration parameters.

(c *ConfigReader) Configure(ctx context.Context, config *cconfig.ConfigParams)

  • ctx: context.Context - operation context.
  • config: *cconfig.ConfigParams - configuration parameters to be set.

Parameterize

Parameterized configuration template given as string with dynamic parameters.

(c *ConfigReader) Parameterize(config string, parameters *cconfig.ConfigParams) (string, error)

  • cconfig: string - string with a configuration template to be parameterized
  • parameters: *cconfig.ConfigParams - dynamic parameters to inject into the template
  • returns: (string, error) - parameterized configuration string.

RemoveChangeListener

Remove a previously added change listener.

RemoveChangeListener(listener crun.INotifiable)

See also