Files
openfoodnetwork/config/initializers/geocoder.rb
Cillian O'Ruanaidh c5e125747f Allow Geocoder to be configured to use different APIs.
This gives instances the option to use other geocoding services, for example MapBox because instances may not have a Google Maps API key if they are using Open Street Map for their map instead of Google.
2020-10-23 13:09:59 +01:00

10 lines
335 B
Ruby

# Google requires an API key with a billing account to use their API.
# The key is stored in config/application.yml.
Geocoder.configure(
timeout: ENV.fetch('GEOCODER_TIMEOUT', 3).to_i,
lookup: ENV.fetch('GEOCODER_SERVICE', :google).to_sym,
use_https: true,
api_key: ENV.fetch('GEOCODER_API_KEY', ENV["GOOGLE_MAPS_API_KEY"])
)