mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2025-07-03 07:49:26 +00:00
Make geo database usage optional (#39)
This commit is contained in:
@ -5,9 +5,12 @@ import (
|
||||
"log"
|
||||
|
||||
"github.com/dcarrillo/whatismyip/internal/setting"
|
||||
"github.com/dcarrillo/whatismyip/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
var geoSvc *service.Geo
|
||||
|
||||
func SetupTemplate(r *gin.Engine) {
|
||||
if setting.App.TemplatePath == "" {
|
||||
t, _ := template.New("home").Parse(home)
|
||||
@ -18,7 +21,8 @@ func SetupTemplate(r *gin.Engine) {
|
||||
}
|
||||
}
|
||||
|
||||
func Setup(r *gin.Engine) {
|
||||
func Setup(r *gin.Engine, geo *service.Geo) {
|
||||
geoSvc = geo
|
||||
r.GET("/", getRoot)
|
||||
r.GET("/scan/tcp/:port", scanTCPPort)
|
||||
r.GET("/client-port", getClientPortAsString)
|
||||
|
Reference in New Issue
Block a user