diff --git a/config/configuration.yml.example b/config/configuration.yml.example index bff4c9740..14acb16a7 100644 --- a/config/configuration.yml.example +++ b/config/configuration.yml.example @@ -209,6 +209,17 @@ default: # allowed values: :memory, :file, :memcache #openid_authentication_store: :memory + # URL of the avatar service + # + # By default, Redmine uses Gravatar as the avatar service for displaying + # the user's icon. You can swich to another Gravatar-compatible service + # such as Libravatar. + # + # Examples: + # avatar_service_url: https://www.gravatar.com + # avatar_service_url: https://seccdn.libravatar.org + avatar_service_url: + # specific configuration options for production environment # that overrides the default ones production: diff --git a/lib/plugins/gravatar/lib/gravatar.rb b/lib/plugins/gravatar/lib/gravatar.rb index 7c2fca6d3..1554672a9 100644 --- a/lib/plugins/gravatar/lib/gravatar.rb +++ b/lib/plugins/gravatar/lib/gravatar.rb @@ -39,6 +39,8 @@ module GravatarHelper :ssl => false, } + AVATAR_SERVICE_URL = Redmine::Configuration['avatar_service_url'] || 'https://www.gravatar.com' + # The methods that will be made available to your views. module PublicMethods @@ -63,7 +65,7 @@ module GravatarHelper # Returns the base Gravatar URL for the given email hash def gravatar_api_url(hash) - 'https://www.gravatar.com/avatar/' + hash.to_s + +"#{AVATAR_SERVICE_URL}/avatar/#{hash}" end # Return the gravatar URL for the given email address.