|
|
Geocoder.configure(
|
|
|
# IP-address geolocation service used by `request.location`.
|
|
|
# ipinfo.io works without an API key at low volume; add an ipinfo_token to the
|
|
|
# Rails credentials to raise the rate limit. For a no-rate-limit /
|
|
|
# privacy-friendly setup, swap this for an offline MaxMind GeoLite2 lookup
|
|
|
# (ip_lookup: :geoip2 + the .mmdb file).
|
|
|
ip_lookup: :ipinfo_io,
|
|
|
ipinfo_io: { api_key: Rails.application.credentials.ipinfo_token.presence },
|
|
|
|
|
|
# A slow or unreachable geo service must never hold up the start of the game.
|
|
|
timeout: 2,
|
|
|
always_raise: [], # swallow lookup errors -> request.location returns nil
|
|
|
|
|
|
# Employees behind the same office gateway share an egress IP, so cache each
|
|
|
# lookup and reuse it instead of hammering the API once per player.
|
|
|
cache: Rails.cache,
|
|
|
cache_options: { expiration: 1.day }
|
|
|
)
|