fix: ip-lookup database lazy loading for all environments (#8052)

The current task for loading `GeoLite2-City.mmdb` doesn't work for all build types. This PR addresses this and move the task to initializer to ensure consistency across environments. 

---------

Co-authored-by: Sojan Jose <sojan@pepalo.com>
Co-authored-by: Sojan Jose <sojan.official@gmail.com>
This commit is contained in:
Mazen Khalil
2024-10-23 09:18:30 +03:00
committed by GitHub
parent c49f5ed800
commit 601a0f8a76
3 changed files with 54 additions and 30 deletions

View File

@@ -24,3 +24,7 @@ module GeocoderConfiguration
end
Geocoder.configure(ip_lookup: :geoip2, geoip2: { file: GeocoderConfiguration::LOOK_UP_DB }) if ENV['IP_LOOKUP_API_KEY'].present?
Rails.application.config.after_initialize do
Geocoder::SetupService.new.perform
end