summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cleanup.go8
-rw-r--r--config.go3
-rw-r--r--web.go13
3 files changed, 15 insertions, 9 deletions
diff --git a/cleanup.go b/cleanup.go
index cfe659d..0d7d89c 100644
--- a/cleanup.go
+++ b/cleanup.go
@@ -7,13 +7,13 @@ import (
)
func cleanup() {
- if err := instance.Close(); err != nil {
- log.Printf("error closing instance: %s", err)
- }
-
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
if err := server.Shutdown(ctx); err != nil {
log.Printf("error shutting down web server: %s", err)
}
+
+ if err := instance.Close(); err != nil {
+ log.Printf("error closing instance: %s", err)
+ }
}
diff --git a/config.go b/config.go
index 35d465f..4586834 100644
--- a/config.go
+++ b/config.go
@@ -2,7 +2,6 @@ package main
import (
"flag"
- "fmt"
"github.com/BurntSushi/toml"
"log"
"os"
@@ -61,7 +60,7 @@ func confLoad() {
return
} else {
for _, key := range meta.Undecoded() {
- fmt.Printf("unused key in configuration file: %s", key.String())
+ log.Printf("unused key in configuration file: %s", key.String())
}
}
}
diff --git a/web.go b/web.go
index c3fe0b7..27ee25e 100644
--- a/web.go
+++ b/web.go
@@ -20,10 +20,17 @@ var (
server = http.Server{}
)
-func webSetup() {
+func init() {
gin.SetMode(gin.ReleaseMode)
- if config.System.Verbose {
- gin.SetMode(gin.DebugMode)
+}
+
+func webSetup() {
+ if d, ok := os.LookupEnv("GIN_DEBUG"); ok {
+ if ginDebug, err := strconv.ParseBool(d); err == nil {
+ if ginDebug {
+ gin.SetMode(gin.DebugMode)
+ }
+ }
}
router = gin.New()