envutil

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package envutil provides shared helpers for environment variable parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key, fallback string) string

Get returns the env var value or fallback when unset/empty.

func GetBoolLoose

func GetBoolLoose(key string, fallback bool) bool

GetBoolLoose parses common bool strings (true/1/yes/on) and uses fallback when unset.

func GetBoolStrict

func GetBoolStrict(key string, fallback bool) bool

GetBoolStrict parses bool values using strconv.ParseBool semantics.

func GetDuration

func GetDuration(key string, fallback time.Duration) time.Duration

GetDuration parses a duration env var, returning fallback when unset/invalid.

func GetDurationOrSeconds

func GetDurationOrSeconds(key string, fallback time.Duration) time.Duration

GetDurationOrSeconds parses duration first; if that fails, parses integer seconds.

func GetFloat

func GetFloat(key string, fallback float64) float64

GetFloat returns the parsed float env var or fallback on missing/invalid values.

func GetInt

func GetInt(key string, fallback int) int

GetInt returns the parsed integer env var or fallback on missing/invalid values.

func LookupBoolLoose

func LookupBoolLoose(key string) (bool, bool)

LookupBoolLoose looks up a bool env var and reports whether a non-empty value was present.

Types

This section is empty.

Jump to

Keyboard shortcuts

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