From 27dd97c9c40ae889fd1fc936ddc7cdb67d290300 Mon Sep 17 00:00:00 2001 From: Bethuel Mmbaga Date: Wed, 3 Dec 2025 14:45:59 +0300 Subject: [PATCH] [management] Add support to disable geolocation service (#4901) --- management/internals/server/modules.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/management/internals/server/modules.go b/management/internals/server/modules.go index 91ce50a79..af9ca5f2d 100644 --- a/management/internals/server/modules.go +++ b/management/internals/server/modules.go @@ -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 {