env

package
v14.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBool

func GetBool(name string, fallback bool) (bool, error)

GetBool fetches and parses a boolean typed environment variable

If the variable is empty, returns `fallback` and no error. If there is an error, returns `fallback` and the error.

func GetDuration added in v14.8.0

func GetDuration(name string, fallback time.Duration) (time.Duration, error)

GetDuration fetches and parses a duration typed environment variable

func GetInt

func GetInt(name string, fallback int) (int, error)

GetInt fetches and parses an integer typed environment variable

If the variable is empty, returns `fallback` and no error. If there is an error, returns `fallback` and the error.

func GetString added in v14.9.0

func GetString(name string, fallback string) string

GetString fetches a given name from the environment and falls back to a default value if the name is not available. The value is stripped of leading and trailing whitespace.

Types

This section is empty.

Jump to

Keyboard shortcuts

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