UNPKG

multiconf

Version:

Work with JSON configs

47 lines (41 loc) 1.55 kB
declare class Multiconf { /** * Load configs from one or more directories, deep-merged in sequence. * Later directories take precedence. Environment variables with the given * prefix are merged on top. * * @param configDir Path to a config directory, or an array of paths. * @param envConfigPrefix Only env vars starting with this prefix are loaded. */ static get( configDir?: string | string[], envConfigPrefix?: string, ): Record<string, unknown>; /** * Load only default configs (`*.json.default`) from one or more directories, * deep-merged in sequence. Later directories take precedence. * * @param configDir Path to a config directory, or an array of paths. */ static getDefault(configDir?: string | string[]): Record<string, unknown>; /** * Enable or disable template rendering for loaded config values. * * @param value `true` to enable template rendering, `false` to disable. */ static setTemplateRendering(value: boolean): typeof Multiconf; /** * Restrict environment variables exposed to template context. * Pass `null` to allow all environment variables. * * @param varNames Allowed environment variable names, or `null`. */ static setAllowedEnvVars(varNames: string[] | null): typeof Multiconf; /** * Set the delimiter used when splitting config directory strings. * * @param delimiter Delimiter string used inside `configDir` values. */ static setDirDelimiter(delimiter: string): typeof Multiconf; } export = Multiconf;