1 | import { ConfigParams } from 'pip-services3-commons-node';
|
2 | import { IConfigurable } from 'pip-services3-commons-node';
|
3 | import { INotifiable } from 'pip-services3-commons-node';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export declare abstract class ConfigReader implements IConfigurable {
|
15 | private _parameters;
|
16 | |
17 |
|
18 |
|
19 | constructor();
|
20 | /**
|
21 | * Configures component by passing configuration parameters.
|
22 | *
|
23 | * @param config configuration parameters to be set.
|
24 | */
|
25 | configure(config: ConfigParams): void;
|
26 | /**
|
27 | * Reads configuration and parameterize it with given values.
|
28 | *
|
29 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
30 | * @param parameters values to parameters the configuration or null to skip parameterization.
|
31 | * @param callback callback function that receives configuration or error.
|
32 | */
|
33 | abstract readConfig(correlationId: string, parameters: ConfigParams, callback: (err: any, config: ConfigParams) => void): void;
|
34 | /**
|
35 | * Parameterized configuration template given as string with dynamic parameters.
|
36 | *
|
37 | * The method uses [[https://handlebarsjs.com Handlebars]] template engine.
|
38 | *
|
39 | * @param config a string with configuration template to be parameterized
|
40 | * @param parameters dynamic parameters to inject into the template
|
41 | * @returns a parameterized configuration string.
|
42 | */
|
43 | protected parameterize(config: string, parameters: ConfigParams): string;
|
44 | /**
|
45 | * Adds a listener that will be notified when configuration is changed
|
46 | * @param listener a listener to be added.
|
47 | */
|
48 | addChangeListener(listener: INotifiable): void;
|
49 | /**
|
50 | * Remove a previously added change listener.
|
51 | * @param listener a listener to be removed.
|
52 | */
|
53 | removeChangeListener(listener: INotifiable): void;
|
54 | }
|