envutil

package
v0.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package envutil provides utilities for reading and validating environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIntFromEnv

func GetIntFromEnv(envVar string, defaultValue, minValue, maxValue int, log *logger.Logger) int

GetIntFromEnv is a generic helper that reads an integer value from an environment variable, validates it against min/max bounds, and returns a default value if invalid. This follows the configuration helper pattern from pkg/workflow/config_helpers.go.

Parameters:

  • envVar: The environment variable name (e.g., "GH_AW_MAX_CONCURRENT_DOWNLOADS")
  • defaultValue: The default value to return if env var is not set or invalid
  • minValue: Minimum allowed value (inclusive)
  • maxValue: Maximum allowed value (inclusive)
  • log: Optional logger for debug output

Returns the parsed integer value, or defaultValue if:

  • Environment variable is not set
  • Value cannot be parsed as an integer
  • Value is outside the [minValue, maxValue] range

Invalid values trigger warning messages to stderr.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL