systopia / de.systopia.osm

CiviCRM OpenStreetmap GeoCoding-Provider
2 stars 17 forks source link

Add caching and app identification to adhere to usage policy #18

Closed artfulrobot closed 3 years ago

artfulrobot commented 3 years ago

Nominatim's usage policy says two things that we weren't doing:

  1. Identify the client via User-Agent.
    This PR uses the configured API key if it exists, otherwise it generates a unique hash to identify each unique CiviCRM site.

  2. Use caching.
    This PR uses a simple SQL cache.

Notes

I came to this as lookups were failing, and I think it could have been due to the policy (1).

The caching (2) is permanent until the cache is cleared ("Cleanup caches" or such), which is probably enough.

bjendres commented 3 years ago

That looks great, thanks @artfulrobot!! I would release this with a new version, since 1.3 is already in beta, is that ok with you?

artfulrobot commented 3 years ago

@bjendres done. Thanks.

bjendres commented 3 years ago

@artfulrobot Here's a 1.4-alpha1 with your code