demarches-normaliennes/config/initializers/geocoder.rb

8 lines
415 B
Ruby
Raw Normal View History

cache_configuration = if ENV['REDIS_CACHE_URL'].present?
{ cache: Redis.new(url: ENV['REDIS_CACHE_URL']), cache_options: { prefix: "geocoder:", expiration: 6.hours } }
else
{ cache: Geocoder::CacheStore::Generic.new(Rails.cache, { prefix: "geocoder:" }) } # generic has no specific expiration support as of geocoder 1.8
end
Geocoder.configure(lookup: :ban_data_gouv_fr, use_https: true, **cache_configuration)