UNPKG

@hapiness/config

Version:

Configuration Library to use it inside Hapiness framework

34 lines (33 loc) 832 B
import { IConfig } from 'config'; export interface ConfigInterface extends IConfig { get<T = ConfigInterface>(key: string): T; } export declare class Config { private static _data; static ensureConfigData(): void; /** * Load the config */ static load(payload?: any): ConfigInterface; static attachProtoDeep(payload: any): ConfigInterface; /** * Return config data */ static getData(): ConfigInterface; /** * Check if the settings exists * * @param {string} key * @returns boolean */ static has(key: string): boolean; /** * Return the config value * from a key * * @param {string} key * @param {any} defaultValue * @returns any */ static get<T = ConfigInterface>(key: string, defaultValue?: any): T; }