env

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(key string, fallback bool) bool

Bool returns a boolean environment value or fallback when unset or invalid.

func BoolPrefixed

func BoolPrefixed(prefixes []string, key string, fallback bool) bool

BoolPrefixed returns the first valid boolean found under the supplied prefixes.

func Duration

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

Duration returns a duration environment value or fallback when unset or invalid.

func DurationPrefixed

func DurationPrefixed(prefixes []string, key string, fallback time.Duration) time.Duration

DurationPrefixed returns the first valid duration under the supplied prefixes.

func Int

func Int(key string, fallback int) int

Int returns an integer environment value or fallback when unset or invalid.

func IntPrefixed

func IntPrefixed(prefixes []string, key string, fallback int) int

IntPrefixed returns the first valid integer found under the supplied prefixes.

func LoadDotEnv

func LoadDotEnv(files ...string) error

LoadDotEnv loads optional dotenv files. Environment variables already set win.

func Prefixed

func Prefixed(prefixes []string, key, fallback string) string

Prefixed returns the first non-empty value found under the supplied prefixes.

func Slice

func Slice(key string) []string

Slice returns a comma-separated environment value as trimmed strings.

func String

func String(key, fallback string) string

String returns an environment value or fallback when unset.

Types

This section is empty.

Jump to

Keyboard shortcuts

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