dawarich/config/initializers/geocoder.rb

24 lines
521 B
Ruby
Raw Normal View History

2024-07-12 15:59:03 -04:00
# frozen_string_literal: true
2024-08-05 15:23:08 -04:00
config = {
# geocoding service request timeout, in seconds (default 3):
# timeout: 5,
# set default units to kilometers:
units: :km,
# caching (see Caching section below for details):
cache: Redis.new,
cache_options: {
2024-07-12 15:59:03 -04:00
expiration: 1.day # Defaults to `nil`
# prefix: "another_key:" # Defaults to `geocoder:`
}
2024-08-05 15:23:08 -04:00
}
if ENV['GOOGLE_PLACES_API_KEY'].present?
config[:lookup] = :google
config[:api_key] = ENV['GOOGLE_PLACES_API_KEY']
end
Geocoder.configure(config)