Browse Source

Moved verbose to flag.

Stephen McQuay 4 years ago
parent
commit
f29d9f7e5e
2 changed files with 11 additions and 9 deletions
  1. 7
    9
      config.go
  2. 4
    0
      main.go

+ 7
- 9
config.go View File

@@ -5,19 +5,17 @@ import (
5 5
 )
6 6
 
7 7
 type Configs struct {
8
-	Verbose bool
9
-	Dbhost  string
10
-	Dbname  string
11
-	Dbport  int
12
-	Port    int
8
+	Dbhost string
9
+	Dbname string
10
+	Dbport int
11
+	Port   int
13 12
 }
14 13
 
15 14
 func NewConfig() *Configs {
16 15
 	return &Configs{
17
-		Verbose: true,
18
-		Dbname:  "itslog",
19
-		Dbport:  5432,
20
-		Port:    80,
16
+		Dbname: "itslog",
17
+		Dbport: 5432,
18
+		Port:   80,
21 19
 	}
22 20
 }
23 21
 

+ 4
- 0
main.go View File

@@ -1,13 +1,17 @@
1 1
 package main
2 2
 
3 3
 import (
4
+	"flag"
4 5
 	"fmt"
5 6
 	"github.com/kelseyhightower/envconfig"
6 7
 	"log"
7 8
 	"net/http"
8 9
 )
9 10
 
11
+var verbose = flag.Bool("verbose", false, "increase logging verbosity")
12
+
10 13
 func main() {
14
+	flag.Parse()
11 15
 	log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
12 16
 	config := NewConfig()
13 17
 	err := envconfig.Process("ITSLOG", config)

Loading…
Cancel
Save