Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goenv

Populate go struct instance with OS environment variables.

Go codecov Go Report Card Go Reference

LIMITATION: only string fields can be tagged with env tag.

type MyAppConfig struct {
	Workspace string `env:"name=MYAPP_HOME"`
	User      string `env:"name=MYAPP_USER"`
	Debug     string `env:"name=MYAPP_DEBUG"`
}

var config = new(MyAppConfig)
if err := goenv.Load(config); err != nil { ... }

if config.Debug == "1" {
    // enable debug output
}

About

Populate go struct instance with OS environment variables.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages