When using Ohana's default settings for the geocoder gem in a Heroku deployment, it is really easy to hit Google's rate limit. This is due to the fact that there is a small pool of outbound IP addresses used by Heroku dynos and Google's rate limiting in the absence of an API key is IP address based.
This PR configures the http_proxy setting for the geocoder library to use the QuotaGuard service if ENV['QUOTAGUARD_URL'] is present. If it is not present, this PR doesn't affect existing behavior. The use of the QuotaGuard Heroku addon with Rails is documented here: https://devcenter.heroku.com/articles/quotaguard#using-with-rails
Since Ohana's documentation for geocoder configuration lives in the wiki, I can update the wiki if this PR is accepted.
Coverage remained the same at 99.368% when pulling efcac403a8f412111472f363d79409d3778cdae4 on appropriate:quotaguard into c7d8e0e1bcaf73d2c8632aa65623f108eeff4485 on codeforamerica:master.
When using Ohana's default settings for the
geocoder
gem in a Heroku deployment, it is really easy to hit Google's rate limit. This is due to the fact that there is a small pool of outbound IP addresses used by Heroku dynos and Google's rate limiting in the absence of an API key is IP address based.This PR configures the
http_proxy
setting for thegeocoder
library to use the QuotaGuard service ifENV['QUOTAGUARD_URL']
is present. If it is not present, this PR doesn't affect existing behavior. The use of the QuotaGuard Heroku addon with Rails is documented here: https://devcenter.heroku.com/articles/quotaguard#using-with-railsSince Ohana's documentation for geocoder configuration lives in the wiki, I can update the wiki if this PR is accepted.