Move models initial setup to server handler (not ideal)

This commit is contained in:
Daniel Carrillo 2024-03-23 20:24:19 +01:00
parent 1988241b98
commit 454f65f087
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
2 changed files with 1 additions and 2 deletions

View File

@ -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)

View File

@ -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