mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 16:26:38 +00:00
[management] Add support to disable geolocation service (#4901)
This commit is contained in:
@@ -2,6 +2,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
@@ -21,7 +22,16 @@ import (
|
|||||||
"github.com/netbirdio/netbird/management/server/users"
|
"github.com/netbirdio/netbird/management/server/users"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
geolocationDisabledKey = "NB_DISABLE_GEOLOCATION"
|
||||||
|
)
|
||||||
|
|
||||||
func (s *BaseServer) GeoLocationManager() geolocation.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 {
|
return Create(s, func() geolocation.Geolocation {
|
||||||
geo, err := geolocation.NewGeolocation(context.Background(), s.Config.Datadir, !s.disableGeoliteUpdate)
|
geo, err := geolocation.NewGeolocation(context.Background(), s.Config.Datadir, !s.disableGeoliteUpdate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user