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 {
|
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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
main.go
4
main.go
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue