feat: add configurable gravatar-compatible base URL (#2083)

This adds the ability to set a base URL for a Gravatar-compatible avatar
service (Gravatar itself, or Libravatar, for instance). The default will
be www.gravatar.com, so nothing will change from current behaviour unless
the user explicitly configures another URL.

Resolves #2082
This commit is contained in:
rhclayto
2026-01-13 06:58:08 -07:00
committed by GitHub
parent bdd3db68fb
commit c5969d9898
3 changed files with 14 additions and 1 deletions

View File

@@ -187,6 +187,7 @@ const (
CorsMaxAge Key = `cors.maxage`
AvatarGravaterExpiration Key = `avatar.gravatarexpiration`
AvatarGravatarBaseURL Key = `avatar.gravatarbaseurl`
BackgroundsEnabled Key = `backgrounds.enabled`
BackgroundsUploadEnabled Key = `backgrounds.providers.upload.enabled`
@@ -456,6 +457,7 @@ func InitDefaultConfig() {
MigrationMicrosoftTodoEnable.setDefault(false)
// Avatar
AvatarGravaterExpiration.setDefault(3600)
AvatarGravatarBaseURL.setDefault("https://www.gravatar.com")
// Project Backgrounds
BackgroundsEnabled.setDefault(true)
BackgroundsUploadEnabled.setDefault(true)
@@ -605,6 +607,12 @@ func InitConfig() {
readConfigValuesFromFiles()
if _, err := url.ParseRequestURI(AvatarGravatarBaseURL.GetString()); err != nil {
log.Fatalf("Could not parse gravatarbaseurl: %s", err)
}
AvatarGravatarBaseURL.Set(strings.TrimRight(AvatarGravatarBaseURL.GetString(), "/"))
if RateLimitStore.GetString() == "keyvalue" {
RateLimitStore.Set(KeyvalueType.GetString())
}