1 | /** @module config */
|
2 | import { ConfigParams } from 'pip-services3-commons-node';
|
3 | import { INotifiable } from 'pip-services3-commons-node';
|
4 | /**
|
5 | * Interface for configuration readers that retrieve configuration from various sources
|
6 | * and make it available for other components.
|
7 | *
|
8 | * Some IConfigReader implementations may support configuration parameterization.
|
9 | * The parameterization allows to use configuration as a template and inject there dynamic values.
|
10 | * The values may come from application command like arguments or environment variables.
|
11 | */
|
12 | export interface IConfigReader {
|
13 | /**
|
14 | * Reads configuration and parameterize it with given values.
|
15 | *
|
16 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
17 | * @param parameters values to parameters the configuration or null to skip parameterization.
|
18 | * @param callback callback function that receives configuration or error.
|
19 | */
|
20 | readConfig(correlationId: string, parameters: ConfigParams, callback: (err: any, config: ConfigParams) => void): void;
|
21 | /**
|
22 | * Adds a listener that will be notified when configuration is changed
|
23 | * @param listener a listener to be added.
|
24 | */
|
25 | addChangeListener(listener: INotifiable): void;
|
26 | /**
|
27 | * Remove a previously added change listener.
|
28 | * @param listener a listener to be removed.
|
29 | */
|
30 | removeChangeListener(listener: INotifiable): void;
|
31 | }
|