Chapter 10, Geocoder now requires API key for Ipstack
JunichiIto opened this issue · 2 comments
JunichiIto commented
In this book, the VCR cassette simulates a request to freegeoip.io, but freegeoip.io (freegeoip.net) was discontinued on July 1st, 2018. So if you want to recreate the cassette, it fails now.
You need these steps to do so:
- Get Ipstack's free API key (See https://ipstack.com/product )
bundle update geocoder
- Create
config/initializers/geocoder.rb
# config/initializers/geocoder.rb
Geocoder.configure(ip_lookup: :ipstack, api_key: "(your-api-key)")
Please see also:
- alexreisner/geocoder#1279
- https://github.com/alexreisner/geocoder/blob/master/README_API_GUIDE.md#ipstack-ipstack
However the API key is credential, so it must be hidden from geocoder.rb
and VCR cassettes in GitHub repository. It might require some more complicated steps😔
ruralocity commented
That's unfortunate—the only reason I added the geocoding feature to the sample app was so I could develop/test against an API that didn't require readers to get API keys. I'll try to address this in a blog post at least in the next couple of weeks.
ruralocity commented
Released.