diff --git a/cleanup.go b/cleanup.go index cfe659dc1cc5c5266d3f9a020fb16828ea7d8fc9..0d7d89c78f463a0b403743984f07bc2189568094 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 35d465faf5f4bdb0a194fb000690e593e6cb1b6b..4586834547ab2423173d64760b544b20a24bfa68 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 c3fe0b7d41004e6afdac9452ae7a658cb8c7d41c..27ee25edaa935662add638fb34f265c4cb0d372d 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()