Handle missing geolix database
Close #313 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
792a2deddb
commit
258550ec94
@ -15,13 +15,13 @@ defmodule MobilizonWeb.Resolvers.Config do
|
|||||||
geolix = Geolix.lookup(ip)
|
geolix = Geolix.lookup(ip)
|
||||||
|
|
||||||
country_code =
|
country_code =
|
||||||
case geolix.city do
|
case Map.get(geolix, :city) do
|
||||||
%{country: %Country{iso_code: country_code}} -> String.downcase(country_code)
|
%{country: %Country{iso_code: country_code}} -> String.downcase(country_code)
|
||||||
_ -> nil
|
_ -> nil
|
||||||
end
|
end
|
||||||
|
|
||||||
location =
|
location =
|
||||||
case geolix.city do
|
case Map.get(geolix, :city) do
|
||||||
%{location: %Location{} = location} -> Map.from_struct(location)
|
%{location: %Location{} = location} -> Map.from_struct(location)
|
||||||
_ -> nil
|
_ -> nil
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user