[management] Add support to disable geolocation service (#4901)

This commit is contained in:
Bethuel Mmbaga
2025-12-03 14:45:59 +03:00
committed by GitHub
parent e87b4ace11
commit 27dd97c9c4

View File

@@ -2,6 +2,7 @@ package server
import (
"context"
"os"
log "github.com/sirupsen/logrus"
@@ -21,7 +22,16 @@ import (
"github.com/netbirdio/netbird/management/server/users"
)
const (
geolocationDisabledKey = "NB_DISABLE_GEOLOCATION"
)
func (s *BaseServer) GeoLocationManager() geolocation.Geolocation {
if os.Getenv(geolocationDisabledKey) == "true" {
log.Info("geolocation service is disabled, skipping initialization")
return nil
}
return Create(s, func() geolocation.Geolocation {
geo, err := geolocation.NewGeolocation(context.Background(), s.Config.Datadir, !s.disableGeoliteUpdate)
if err != nil {