diff --git a/app/init/resources.php b/app/init/resources.php index ab241035fb..45c639951d 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -323,15 +323,6 @@ function getDevice(string $root, string $connection = ''): Device } } -$container->set('geodb', function ($register) { - /** @var Utopia\Registry\Registry $register */ - try { - return $register->get('geodb'); - } catch (\Throwable) { - return; - } -}, ['register']); - $container->set('passwordsDictionary', function ($register) { /** @var Utopia\Registry\Registry $register */ return $register->get('passwordsDictionary'); diff --git a/app/init/resources/request.php b/app/init/resources/request.php index b4ad91b756..8486a09b77 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -1466,10 +1466,10 @@ return function (Container $container): void { return $getGeoForIp($ip); }, ['request', 'getGeoForIp']); - $container->set('getGeoForIp', function (Locale $locale, $geodb) { + $container->set('getGeoForIp', function (Locale $locale) { $cache = []; - return function (string $ip) use ($locale, $geodb, &$cache): GeoRecord { + return function (string $ip) use ($locale, &$cache): GeoRecord { if (isset($cache[$ip])) { return $cache[$ip]; } @@ -1478,7 +1478,6 @@ return function (Container $container): void { $geoEndpoint = System::getEnv('_APP_GEO_ENDPOINT', ''); $geoSecret = System::getEnv('_APP_GEO_SECRET', ''); - // Try the geo service first (used in Docker/Cloud deployments) if (!empty($geoEndpoint) && !empty($geoSecret) && filter_var($ip, FILTER_VALIDATE_IP)) { try { $client = new Client(); @@ -1497,21 +1496,6 @@ return function (Container $container): void { } } - // Fallback to local MaxMind DB for self-hosted deployments - if (empty($record) && $geodb !== null) { - try { - $dbRecord = $geodb->get($ip); - if ($dbRecord) { - $record = [ - 'countryCode' => $dbRecord['country']['iso_code'] ?? '--', - 'continentCode' => $dbRecord['continent']['code'] ?? '--', - ]; - } - } catch (\Throwable $th) { - Console::warning('Local geodb lookup failed: ' . $th->getMessage()); - } - } - $countryCode = $record['countryCode'] ?? '--'; $continentCode = $record['continentCode'] ?? '--'; $unknownCountry = $locale->getText('locale.country.unknown'); @@ -1541,5 +1525,5 @@ return function (Container $container): void { return $geoRecord; }; - }, ['locale', 'geodb']); + }, ['locale']); };