As a user, we would like to be able to customize the static Gravatar URL via a configuration switch.
As an example the following code line. All Gravatar endpoints are statically stored in the source code. Since some services, like quay, only offer Gravatar and some employees do not want to use the service, we have provided a separate endpoint in our network.
def _get_url(self, hash_value, size=16):
return "%s://www.gravatar.com/avatar/%s?d=404&size=%s" % (
self.preferred_url_scheme,
hash_value,
size,
)
With new config paramater for Gravatar endpoint:
def _get_url(self, hash_value, size=16): return "%s://%s/avatar/%s?d=404&size=%s" % ( self.preferred_url_scheme, app.config["GRAVATAR_URI"], hash_value, size, )