From 454f65f087f51f175d5e4ecb7bb7def9492f5d26 Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Sat, 23 Mar 2024 20:24:19 +0100 Subject: [PATCH] Move models initial setup to server handler (not ideal) --- cmd/whatismyip.go | 2 -- server/server.go | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/whatismyip.go b/cmd/whatismyip.go index b172965..d4eaf2b 100644 --- a/cmd/whatismyip.go +++ b/cmd/whatismyip.go @@ -12,7 +12,6 @@ import ( "github.com/dcarrillo/whatismyip/server" "github.com/gin-contrib/secure" - "github.com/dcarrillo/whatismyip/models" "github.com/dcarrillo/whatismyip/router" "github.com/gin-gonic/gin" ) @@ -27,7 +26,6 @@ func main() { os.Exit(1) } - models.Setup(setting.App.GeodbPath.City, setting.App.GeodbPath.ASN) engine := setupEngine() router.SetupTemplate(engine) router.Setup(engine) diff --git a/server/server.go b/server/server.go index 4817b50..0e444b1 100644 --- a/server/server.go +++ b/server/server.go @@ -28,6 +28,7 @@ func Setup(servers []Server) *Manager { func (m *Manager) Run() { m.start() + models.Setup(setting.App.GeodbPath.City, setting.App.GeodbPath.ASN) signalChan := make(chan os.Signal, len(m.servers)) signal.Notify(signalChan, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM) var s os.Signal