github.com/kelseyhightower/envconfig
// first, define the structure
type CustomConfig struct {
Targets []string `envconfig:"TARGETS" default:"SOMETHING"`
Timeout time.Duration `envconfig:"TIMEOUT"`
}
// load the config
var conf CustomConfig
envconfig.Load(&conf)
envconfig.LoadWithPrefix("PREFIX", &conf)
func loadConfig(conf interface{}){
if err := envconfig.Process("prefix", conf); err != nil {
...
}
}