Moved verbose to flag.
This commit is contained in:
parent
3d873f48f1
commit
f29d9f7e5e
16
config.go
16
config.go
|
@ -5,19 +5,17 @@ import (
|
|||
)
|
||||
|
||||
type Configs struct {
|
||||
Verbose bool
|
||||
Dbhost string
|
||||
Dbname string
|
||||
Dbport int
|
||||
Port int
|
||||
Dbhost string
|
||||
Dbname string
|
||||
Dbport int
|
||||
Port int
|
||||
}
|
||||
|
||||
func NewConfig() *Configs {
|
||||
return &Configs{
|
||||
Verbose: true,
|
||||
Dbname: "itslog",
|
||||
Dbport: 5432,
|
||||
Port: 80,
|
||||
Dbname: "itslog",
|
||||
Dbport: 5432,
|
||||
Port: 80,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
main.go
4
main.go
|
@ -1,13 +1,17 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var verbose = flag.Bool("verbose", false, "increase logging verbosity")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
|
||||
config := NewConfig()
|
||||
err := envconfig.Process("ITSLOG", config)
|
||||
|
|
Loading…
Reference in New Issue