Skip to content

go package for convenient extraction of values of environment variables

License

Notifications You must be signed in to change notification settings

reinventer/defenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DefEnv

GoDoc Build Status

DefEnv is a go package that contains methods for extracting environment variables and converting them to specified types. If there is no environment variable, the default value is used.

There are two types of methods in a package: ordinary and strict. If there is no environment variable, or if a parsing error occurs, ordinary methods return a default value.

value := defenv.Int("WORKER_NUMBER", 8)

Unlike ordinary methods, strict methods return an error when parsing fails.

value, err := defenv.IntStrict("WORKER_NUMBER", 8)

Methods:

Type Ordinary Strict
bool Bool BoolStrict
time.Duration Duration DurationStrict
float64 Float64 Float64Strict
int Int IntStrict
int64 Int64 Int64Strict
string String -
uint Uint UintStrict
uint64 Uint64 Uint64Strict

Docs

See package documentation at https://godoc.org/github.com/reinventer/defenv

About

go package for convenient extraction of values of environment variables

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages