Moved verbose to flag.

This commit is contained in:
Stephen McQuay 2013-12-20 23:35:24 -08:00
parent 3d873f48f1
commit f29d9f7e5e
2 changed files with 11 additions and 9 deletions

View File

@ -5,19 +5,17 @@ import (
) )
type Configs struct { type Configs struct {
Verbose bool Dbhost string
Dbhost string Dbname string
Dbname string Dbport int
Dbport int Port int
Port int
} }
func NewConfig() *Configs { func NewConfig() *Configs {
return &Configs{ return &Configs{
Verbose: true, Dbname: "itslog",
Dbname: "itslog", Dbport: 5432,
Dbport: 5432, Port: 80,
Port: 80,
} }
} }

View File

@ -1,13 +1,17 @@
package main package main
import ( import (
"flag"
"fmt" "fmt"
"github.com/kelseyhightower/envconfig" "github.com/kelseyhightower/envconfig"
"log" "log"
"net/http" "net/http"
) )
var verbose = flag.Bool("verbose", false, "increase logging verbosity")
func main() { func main() {
flag.Parse()
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile) log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
config := NewConfig() config := NewConfig()
err := envconfig.Process("ITSLOG", config) err := envconfig.Process("ITSLOG", config)