import { DotenvConfigOptions } from 'dotenv'; export interface ModuleConfig { [key: string]: any; } export interface Config { [key: string]: ModuleConfig; } export declare type CustomHelper = { [key: string]: (...args: any[]) => any; }; export interface ConfigOptions extends Partial { modifyConfigName?: (name: string) => string; } export declare class ConfigService { [key: string]: Config | CustomHelper | ((...args: any[]) => any) | any; private static config; private readonly helpers; static rootPath?: string; /** * @deprecated use rootPath instead */ static srcPath?: string; /** * @param {Config} config */ constructor(config?: Config); /** * Load configuration from file system * @param glob string * @param {DotenvOptions} options * @returns {Promise} */ static load(glob: string, options?: ConfigOptions | false): Promise; /** * Load config synchronously * @param {string} glob * @param {DotenvOptions | false} options */ static loadSync(glob: string, options?: ConfigOptions | false): ConfigService; /** * Get the param or use default * * @param {String} key * @param {any} value default * @returns {any|undefined} */ static get(param: string | string[], value?: any): any; /** * Get the param or use default * * @param param * @param {any} value default * @returns {any} */ get(param: string | string[], value?: any): any; /** * Set config value at runtime * @param {string} param * @param value * @returns {Config} */ set(param: string | string[], value?: any): Config; /** * Check the param exists * * @param param * @returns {boolean} */ has(param: string | string[]): boolean; /** * Merge configuration * @param glob * @param options */ merge(glob: string, options?: ConfigOptions): Promise; /** * Merge configuration synchronously * @param {string} glob * @param {DotenvOptions} options * @returns {ConfigService} */ mergeSync(glob: string, options?: ConfigOptions): ConfigService; /** * @param {string} name * @param {CustomHelper} fn * @returns {ConfigService} */ registerHelper(name: string, fn: (...args: any[]) => any): ConfigService; /** * @param {string} dir * @returns {string} */ static root(dir?: string): string; /** * @param {string} dir * @returns {string} * * @deprecated use configService.root() instead */ static src(dir?: string): string; /** * Resolves and stores sources directory for application. * @param {string} startPath * The path for search starting. Can be any path under app sources path. */ static resolveRootPath(startPath: string): typeof ConfigService; /** * @param startPath * * @deprecated use configService.resolveRootPath() instead */ static resolveSrcPath(startPath: string): typeof ConfigService; /** * @param {string | string[]} glob * @param {DotenvOptions | false} options * @returns {Promise} */ protected static loadConfigAsync(glob: string, options?: ConfigOptions | false): Promise; /** * Load config synchronously * @param {string} glob * @param {DotenvOptions | false} options * @returns {Config} */ protected static loadConfigSync(glob: string, options?: ConfigOptions | false): Config; /** * Config graph from an array of paths * @param configPaths * @param modifyConfigName * @returns {any} */ protected static configGraph(configPaths: string[], modifyConfigName?: (name: string) => string): Config; /** * @param config * @returns {string} */ protected bindCustomHelpers(config: any): any; /** * Get config name from a file path * @param {string} file * @returns {string} */ protected static getConfigName(file: string): string; /** * Loads env variables via dotenv. * @param {DotenvConfigOptions | false} options */ protected static loadEnv(options?: DotenvConfigOptions | false): void; /** * Default dotenv config point to a .env * on the cwd path * @returns {{path: string}} */ protected static defaultDotenvConfig(): { path: string; }; }