Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FileConfigReader

Abstract config reader that reads configuration from a file. Child classes add support for config files in their specific format like JSON, YAML or property files.

Configuration parameters

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

IConfigReader

see

ConfigReader

Hierarchy

Implements

  • IConfigurable

Index

Constructors

constructor

Methods

configure

  • configure(config: ConfigParams): void

getPath

  • getPath(): string

Protected parameterize

  • parameterize(config: string, parameters: ConfigParams): string
  • Parameterized configuration template given as string with dynamic parameters.

    The method uses Handlebars template engine: https://handlebarsjs.com

    Parameters

    • 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.

Abstract readConfig

  • readConfig(correlationId: string, parameters: ConfigParams, callback: function): void
  • Reads configuration and parameterize it with given values.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • parameters: ConfigParams

      values to parameters the configuration or null to skip parameterization.

    • callback: function

      callback function that receives configuration or error.

        • (err: any, config: ConfigParams): void
        • Parameters

          • err: any
          • config: ConfigParams

          Returns void

    Returns void

setPath

  • setPath(path: string): void
  • Set the path to configuration file.

    Parameters

    • path: string

      a new path to configuration file.

    Returns void

Generated using TypeDoc