@nexe/config-manager
Version:
Nexe Config Manager - A flexible configuration management solution with multiple sources and hot reload support
34 lines • 986 B
TypeScript
import 'reflect-metadata';
import type { ConfigOptions, IConfigManager, IConfigSource } from './interfaces';
/**
* 配置管理器实现
*/
export declare class ConfigManager implements IConfigManager {
private sources;
private subscriptions;
/**
* 添加配置源
*/
addSource(source: IConfigSource, priority?: number): void;
/**
* 获取配置值
*/
get<T>(key: string, defaultValue?: T, options?: ConfigOptions): Promise<T>;
/**
* 获取强类型配置对象
*/
getConfig<T>(configClass: new () => T, options?: ConfigOptions): Promise<T>;
/**
* 订阅配置变更
*/
subscribe<T>(key: string, callback: (value: T) => void, options?: ConfigOptions): void;
/**
* 取消订阅配置变更
*/
unsubscribe(key: string, options?: ConfigOptions): void;
/**
* 设置配置源的变更订阅
*/
private setupSourceSubscription;
}
//# sourceMappingURL=config-manager.d.ts.map