Skip to content

Repository files navigation

About

The typedenv is a tiny library that provides functionality for working with typed environment variables.

Usage

To get the library, use:

go get -u github.com/orewaee/typedenv

You can get env of a certain type as shown below. If the variable is missing, zero-value for the specified type will be returned.

key := typedenv.String("KEY")

You can also specify a default value that will be returned if env is not present.

number := typedenv.Int("NUMBER", 21)

If a default value is used many times, use global default values.

typedenv.DefaultBool("BOOL", true)

You can also check the presence of a key in the environment or among default values.

exists := typedenv.Lookup("KEY")

About

Tiny library for working with typed environment variables

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages