@re-shell/cli
Version:
Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja
62 lines (61 loc) • 1.88 kB
TypeScript
import { EventEmitter } from 'events';
export interface ConfigSchema {
[key: string]: {
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
default?: any;
required?: boolean;
description?: string;
validator?: (value: any) => boolean;
transformer?: (value: any) => any;
};
}
export interface ConfigOptions {
globalPath?: string;
projectPath?: string;
schema?: ConfigSchema;
defaults?: Record<string, any>;
envPrefix?: string;
autoSave?: boolean;
watch?: boolean;
}
export declare class ConfigManager extends EventEmitter {
private globalPath;
private projectPath?;
private schema?;
private defaults;
private envPrefix;
private autoSave;
private watchEnabled;
private config;
private projectConfig;
private envConfig;
private runtimeConfig;
private watchers;
constructor(options?: ConfigOptions);
private load;
private loadEnvConfig;
private parseEnvValue;
private mergeConfig;
private validateConfig;
private watchFile;
get<T = any>(key: string, defaultValue?: T): T;
set(key: string, value: any): void;
private setNestedValue;
has(key: string): boolean;
delete(key: string): void;
private deleteNestedValue;
getAll(): Record<string, any>;
save(filePath?: string): void;
reload(): void;
reset(): void;
watchFiles(enabled: boolean): void;
dispose(): void;
getGlobalPath(): string;
getProjectPath(): string | undefined;
setProjectPath(path: string): void;
getSchema(): ConfigSchema | undefined;
setSchema(schema: ConfigSchema): void;
}
export declare function createConfigManager(options?: ConfigOptions): ConfigManager;
export declare function getGlobalConfig(): ConfigManager;
export declare function setGlobalConfig(config: ConfigManager): void;