config: add branding settings (#3558)

This commit is contained in:
Caleb Doxsey 2022-08-16 14:51:47 -06:00 committed by GitHub
parent c9421ec146
commit 46703b9419
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 156 additions and 13 deletions

View file

@ -0,0 +1,35 @@
package httputil
// The BrandingOptions customize the user info and error pages.
type BrandingOptions interface {
GetPrimaryColor() string
GetSecondaryColor() string
GetDarkmodePrimaryColor() string
GetDarkmodeSecondaryColor() string
GetLogoUrl() string
GetFaviconUrl() string
GetErrorMessageFirstParagraph() string
}
// AddBrandingOptionsToMap adds the branding options to the map.
func AddBrandingOptionsToMap(dst map[string]any, brandingOptions BrandingOptions) {
if brandingOptions == nil {
return
}
if brandingOptions.GetPrimaryColor() != "" {
dst["primaryColor"] = brandingOptions.GetPrimaryColor()
}
if brandingOptions.GetSecondaryColor() != "" {
dst["secondaryColor"] = brandingOptions.GetSecondaryColor()
}
if brandingOptions.GetLogoUrl() != "" {
dst["logoUrl"] = brandingOptions.GetLogoUrl()
}
if brandingOptions.GetFaviconUrl() != "" {
dst["faviconUrl"] = brandingOptions.GetFaviconUrl()
}
if brandingOptions.GetErrorMessageFirstParagraph() != "" {
dst["errorMessageFirstParagraph"] = brandingOptions.GetErrorMessageFirstParagraph()
}
}