Skip to content

Commit

Permalink
Move models initial setup to server handler (not ideal)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarrillo committed Mar 23, 2024
1 parent 1988241 commit 454f65f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 0 additions & 2 deletions cmd/whatismyip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 454f65f

Please sign in to comment.