UNPKG

i-do-config

Version:

Provide app configuration as key-value pairs from multiple providers. Inspired by ASP.net Core

26 lines (25 loc) 1.39 kB
import { IConfiguration } from "./interfaces/i-configuration"; import { IConfigurationValueProvider } from "./interfaces/i-configuration-value-provider"; export declare class Configuration implements IConfiguration { private configValueProviders; constructor(configValueProviders?: IConfigurationValueProvider[]); /** * Get a section from configured value providers. Later providers overwrite * values with the same key. * * @param key The key for wich to get the section */ getSection(key: string): object; /** * Get a value from configuration * * @param key The key for which to get value * @param defaultValue A default value that will be returned when no provider yields a result * @param preferredProvider Optional. When specified return a value only from this provider * @return The configuration value for key */ getValue(key: string, defaultValue?: boolean | number | string, preferredProvider?: string): boolean | number | string; getValueAsString(key: string, defaultValue?: boolean | number | string, preferredProvider?: string): string; getValueAsNumber(key: string, defaultValue?: boolean | number | string, preferredProvider?: string): number; getValueAsBoolean(key: string, defaultValue?: boolean | number | string, preferredProvider?: string): boolean; }