Environment Variable config loader for go
The import path "gopkg.daemonl.com/envconf" is equivalent to
"github.com/daemonl/envconf.go", but some tools aren't keen on the
.go
suffix. (And what if I wanted to write this for another language?)
import "gopkg.daemonl.com/envconf"
var config struct {
Bind string `env:"BIND" default:":8080"`
}
func main() {
if err := envconf.Parse(&config); err != nil {
log.Fatal(err.Error())
}
}