Simplify geolix database config

This commit is contained in:
Uku Taht 2021-10-18 15:49:55 +02:00
parent 2ca3baeafd
commit 950bd012d5
2 changed files with 3 additions and 4 deletions

View File

@ -386,7 +386,8 @@ if config_env() != :test && geolite2_country_db do
%{
id: :country,
adapter: Geolix.Adapter.MMDB2,
source: geolite2_country_db
source: geolite2_country_db,
result_as: :raw
}
]
end

View File

@ -194,9 +194,7 @@ defmodule PlausibleWeb.Api.ExternalController do
PlausibleWeb.RemoteIp.get(conn)
|> Geolix.lookup()
if result && result[:country] && result[:country].country do
result[:country].country.iso_code
end
get_in(result, [:country, :country, :iso_code])
end
defp parse_referrer(_, nil), do: nil