Libraries
    Preparing search index...

    Function parseEnvFlat

    • Convenience wrapper for simple flat configs where each key is both the config property name and the environment variable name.

      Equivalent to calling parseEnv() with every entry wrapped in env().

      Type Parameters

      • T extends FlatEnvSchemas

      Parameters

      • schemas: T

        A record mapping env var names to schema builders.

      • Optionalsource: Record<string, string | undefined>

        The environment variable source. Defaults to process.env.

      Returns InferFlatEnv<T>

      const config = parseEnvFlat({
      DB_HOST: string().default('localhost'),
      DB_PORT: number().coerce().default(5432),
      JWT_SECRET: string().minLength(32),
      });
      // Type: { DB_HOST: string, DB_PORT: number, JWT_SECRET: string }