do configs through env

This commit is contained in:
sm
2013-12-20 23:04:33 -08:00
parent 54489f603a
commit a8e03e721e
2 changed files with 48 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
package main
import (
"github.com/kelseyhightower/envconfig"
"log"
)
func main() {
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
config := NewConfig()
err := envconfig.Process("ITSLOG", config)
if err != nil {
log.Fatal(err)
}
if err := config.validate(); err != nil {
log.Fatal(err)
}
log.Printf("%+v", config)
}