UNPKG

zod-config

Version:

Load configuration variables from multiple sources with flexible adapters, ensuring type safety with Zod.

29 lines (25 loc) 1.24 kB
import { S as SchemaConfig, C as Config, I as InferredDataConfig, a as SyncConfig } from './types-6327f0b9.js'; export { A as Adapter, L as Logger, b as SyncAdapter } from './types-6327f0b9.js'; import 'zod/v3'; import 'zod/v4/core'; /** * Load config from adapters asynchronously. * * - If no adapters are provided, we will read from process.env. * - If multiple adapters are provided, we will deep merge the data from all adapters, with the last adapter taking precedence. * - If any adapter fails, we will still return the data from other adapters. * @param config * @returns parsed config */ declare const loadConfig: <T extends SchemaConfig>(config: Config<T>) => Promise<InferredDataConfig<T>>; /** * Synchronously load config from adapters. * * - If no adapters are provided, we will read from process.env. * - If multiple adapters are provided, we will deep merge the data from all adapters, with the last adapter taking precedence. * - If any adapter fails, we will still return the data from other adapters. * @param config * @returns parsed config */ declare const loadConfigSync: <T extends SchemaConfig>(config: SyncConfig<T>) => InferredDataConfig<T>; export { Config, SyncConfig, loadConfig, loadConfigSync };