From 6591ca67d36d9f2234aac4ae1b28ed8194dddbaf Mon Sep 17 00:00:00 2001 From: William Clark Date: Wed, 6 Dec 2023 19:23:21 +0000 Subject: [PATCH] simplify --- main.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index f24e506..e99eb16 100644 --- a/main.go +++ b/main.go @@ -54,24 +54,20 @@ func main() { } defer dbPort.Close() - // if noweb is false, then start web service - if !cfg.Board.NoWeb && cfg.API[0].Enabled { - apiPort = http.NewGinAdapter(corePort, cfg) - go apiPort.Run() - } - color.Set(color.FgHiRed) fmt.Printf("Started on: %s\n", time.Now().Format(time.DateTime)) color.Unset() + // if noweb is false and HTTP/REST API is enabled then start web service if !cfg.Board.NoWeb && cfg.API[0].Enabled { + apiPort = http.NewGinAdapter(corePort, cfg) + go apiPort.Run() + color.Set(color.FgHiGreen) fmt.Printf("TH7 API is live on http://localhost:%d/\n", cfg.API[0].Port) color.Unset() } - fmt.Println(cfg.API[0]) - sig := <-kill log.Printf("Caught signal %v", sig) }