Skip to main content

get(...variableNames): (string | number | boolean)[]

Defined in: src/config-manager/getters.ts:84

Retrieves and validates multiple environment variables with automatic type detection. Analyzes each environment variable value and returns the appropriate type (string, number, or boolean). Reuses existing validation functions for consistency.

Type detection rules:

  • "true"/"false" (case-insensitive) → boolean
  • Valid numeric strings → number
  • Everything else → string

Parameters

variableNames

...string[]

The names of the environment variables to retrieve

Returns

(string | number | boolean)[]

An array of values with their automatically detected types

Throws

When any environment variable is missing or empty

Example

// Environment: PORT=3000, DEBUG=true, API_URL=https://api.example.com
const [port, debug, apiUrl] = get('PORT', 'DEBUG', 'API_URL');
// Returns: [3000, true, "https://api.example.com"]
// Types: [number, boolean, string]