UNPKG

@commenthol/app-config

Version:

set values in global app configuration

43 lines (42 loc) 1.17 kB
export function getGlobalConfigPathname(appName: string, filename?: string): string; export class AppConfig { /** * @param {{ * appName: string * schema?: Record<string, ValibotSchema> * filename?: string|URL * defaults?: Record<string, any> * }} options */ constructor(options: { appName: string; schema?: Record<string, ValibotSchema>; filename?: string | URL; defaults?: Record<string, any>; }); schema: Record<string, v.BaseSchema<any, any, any>> | undefined; filename: string; config: Record<string, any>; /** * @param {string} key * @param {string|null|undefined} value */ set(key: string, value: string | null | undefined): void; /** * @param {string|string[]} key * @returns {any} */ get(key: string | string[]): any; /** * @private * creates or overwrites file after failures */ private _create; read(): Promise<void>; /** * @returns {Promise<void>} */ write(): Promise<void>; } export type ValibotSchema = v.BaseSchema<any, any, any>; import { v } from '#validate.js';