Documentation
¶
Overview ¶
Package env provides a small Reader abstraction over process environment access. Production code injects a Reader instead of calling os.Getenv directly so tests can substitute Map and avoid mutating the global process environment (which races under t.Parallel()).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get returns the value of name, or "" when unset. Convenience wrapper around Lookup matching the os.Getenv signature.
func GetBool ¶
GetBool parses common true/false spellings (1/0, true/false, yes/no, on/off — case-insensitive). Returns def when unset or empty. Returns an error when set but unparseable.
Types ¶
type Map ¶
Map is a Reader backed by an in-memory map. The zero value is usable and reports every variable as unset.
Map is safe to use concurrently for reads; tests typically populate it once before injecting it.
type Reader ¶
type Reader interface {
// Lookup returns the value of name and whether it was set. An
// empty string with ok==true means "set to empty"; an empty
// string with ok==false means "unset".
Lookup(name string) (value string, ok bool)
}
Reader reads environment-variable-style configuration.