dash-core
Version:
A foundational toolkit of types, collections, services, and architectural patterns designed to accelerate application development.
23 lines (22 loc) • 1.35 kB
TypeScript
import { ServiceLogger } from 'dash-core';
/** Reads config files and merges with defaults.*/
export declare class ConfigReader {
private readonly logger;
constructor(logger?: ServiceLogger);
/**
* Reads the configuration from the specified file and populates the given object with values from the file.
* @param {string} configPath - The path to the configuration file (e.g., './config.json').
* @param {TConfig} defaultConfig - The object that contains the default configuration values.
* @returns {Promise<TConfig>} A promise that resolves to the merged configuration object.
* @template TConfig - The type of the configuration object.
*/
readConfig<TConfig>(configPath: string, defaultConfig: TConfig): Promise<TConfig>;
/**
* Reads the configuration from the specified file and populates the given object with values from the file.
* @param {string} configPath - The path to the configuration file (e.g., './config.json').
* @param {TConfig} defaultConfig - The object that contains the default configuration values.
* @returns {Promise<TConfig>} A promise that resolves to the merged configuration object.
* @template TConfig - The type of the configuration object.
*/
static readConfig<TConfig>(configPath: string, defaultConfig: TConfig): Promise<TConfig>;
}