]> git.openstreetmap.org Git - rails.git/blobdiff - lib/osm.rb
rename internal variable
[rails.git] / lib / osm.rb
index bc3eb48c5bcaf71034ff670d36546fb27c67a353..3e4b5dcee4b005d8b4db2bc2b7e81bf8bf9eeedc 100644 (file)
@@ -513,15 +513,8 @@ module OSM
   def self.ip_to_country(ip_address)
     ipinfo = maxmind_database.lookup(ip_address) if Settings.key?(:maxmind_database)
 
-    if ipinfo.found?
-      country = ipinfo.country.iso_code
-    else
-      country = http_client.get("https://api.hostip.info/country.php?ip=#{ip_address}").body
-      country = "GB" if country == "UK"
-    end
+    return ipinfo.country.iso_code if ipinfo&.found?
 
-    country
-  rescue StandardError
     nil
   end