dotenvxjs
Version:
dotenvx is the official Node.js library for .envx files, offering advanced type validation, intelligent interpolation, and conditional logic. It makes environment management safer, more dynamic, and easier to maintain.
17 lines (14 loc) • 593 B
TypeScript
type EnvType = "string" | "number" | "boolean" | "enum" | "email" | "url";
interface EnvVarSchema {
type: EnvType;
required?: boolean;
default?: string | number | boolean;
values?: Array<string>;
deprecated?: boolean;
description?: string;
}
type EnvSchema = Record<string, EnvVarSchema>;
type EnvResult = Record<string, string | number | boolean>;
declare function getEnvx<T extends Record<string, any> = EnvResult>(filePath?: string, schema?: EnvSchema): T;
declare function loadEnvx(filePath?: string, schema?: EnvSchema): EnvResult;
export { getEnvx, loadEnvx };