@karmaniverous/get-dotenv
    Preparing search index...

    Function dotenvExpand

    • Recursively expands environment variables in a string. Variables may be presented with optional default as $VAR[:default] or ${VAR[:default]}. Unknown variables will expand to an empty string.

      Parameters

      • value: undefined | string

        The string to expand.

      • ref: ProcessEnv = process.env

        The reference object to use for variable expansion.

      Returns undefined | string

      The expanded string.

      process.env.FOO = 'bar';
      dotenvExpand('Hello $FOO'); // "Hello bar"
      dotenvExpand('Hello $BAZ:world'); // "Hello world"

      The expansion is recursive. If a referenced variable itself contains references, those will also be expanded until a stable value is reached. Escaped references (e.g. \$FOO) are preserved as literals.