/** Environment Manager - Unified Environment Variable Utilities */ import dotenv from 'dotenv'; export interface EnvBackup { [key: string]: string | undefined; } /** * Handle snapshot-related errors with logging * Logs the error context and rethrows for proper propagation * @param err - The error to handle * @throws Always throws the provided error after logging */ export declare function handleSnapshotError(err: unknown): never; /** * Backup current environment variables * @param keys - Optional array of specific keys to backup (defaults to all) * @returns Object containing backed up environment variables */ export declare const backupEnvVars: (keys?: string[]) => EnvBackup; /** * Snapshot specific environment variables with logging * Alternative API that requires explicit variable names * @param vars - Array of environment variable names to snapshot * @returns Object containing the snapshotted environment variables */ export declare function snapshotEnv(vars: string[]): Record; /** * Restore environment variables from backup * @param backup - Backup object created by backupEnvVars * @param keys - Optional array of specific keys to restore (defaults to all keys in backup) */ export declare const restoreEnvVars: (backup: EnvBackup, keys?: string[]) => void; /** * Execute function with saved environment state * @param fn - Function to execute * @param envVars - Environment variables to set during execution * @returns Result of the function execution */ export declare const withSavedEnv: (fn: () => T, envVars?: Record) => T; /** * Load environment variables from .env file * @param path - Optional path to .env file * @returns Parsed environment variables */ export declare const loadEnv: (path?: string) => Record; /** * Configure environment with defaults and overrides * @param defaults - Default environment variables * @param overrides - Override environment variables * @param envPath - Optional path to .env file */ export declare const configureEnv: (defaults?: Record, overrides?: Record, envPath?: string) => void; /** * Initialize dotenv configuration with simple interface * This function matches the pattern used across config files */ export declare const initializeDotenv: () => void; /** * Gets an environment variable with a default fallback value * @param key - Environment variable name * @param defaultValue - Default value if variable is not set * @returns Environment variable value or default */ export declare const getEnvVar: (key: string, defaultValue: string) => string; export { dotenv }; //# sourceMappingURL=envManager.d.ts.map