diff --git a/README.md b/README.md index 6adf3dfe..377b1689 100644 --- a/README.md +++ b/README.md @@ -180,9 +180,11 @@ If you want to test it locally, see [Docker](#docker). | `web.address` | Address to listen on. | `0.0.0.0` | | `web.port` | Port to listen on. | `8080` | | `ui` | UI configuration. | `{}` | -| `ui.title` | Title of the page. | `Health Dashboard ǀ Gatus` | -| `ui.logo` | URL to the logo to display | `""` | -| `Maintenance` | [Maintenance](#maintenance). | `{}` | +| `ui.title` | [Title of the document](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title). | `Health Dashboard ǀ Gatus` | +| `ui.header` | Header at the top of the dashboard. | `Health Status` | +| `ui.logo` | URL to the logo to display. | `""` | +| `ui.link` | Link to open when the logo is clicked. | `""` | +| `maintenance` | [Maintenance configuration](#maintenance). | `{}` | ### Conditions diff --git a/config/ui/ui.go b/config/ui/ui.go index 5b445496..1ad5c1f3 100644 --- a/config/ui/ui.go +++ b/config/ui/ui.go @@ -6,8 +6,10 @@ import ( ) const ( - defaultTitle = "Health Dashboard | Gatus" - defaultLogo = "" + defaultTitle = "Health Dashboard | Gatus" + defaultHeader = "Health Status" + defaultLogo = "" + defaultLink = "" ) var ( @@ -18,15 +20,19 @@ var ( // Config is the configuration for the UI of Gatus type Config struct { - Title string `yaml:"title"` // Title of the page - Logo string `yaml:"logo"` // Logo to display on the page + Title string `yaml:"title,omitempty"` // Title of the page + Header string `yaml:"header,omitempty"` // Header is the text at the top of the page + Logo string `yaml:"logo,omitempty"` // Logo to display on the page + Link string `yaml:"link,omitempty"` // Link to open when clicking on the logo } // GetDefaultConfig returns a Config struct with the default values func GetDefaultConfig() *Config { return &Config{ - Title: defaultTitle, - Logo: defaultLogo, + Title: defaultTitle, + Header: defaultHeader, + Logo: defaultLogo, + Link: defaultLink, } } @@ -35,6 +41,12 @@ func (cfg *Config) ValidateAndSetDefaults() error { if len(cfg.Title) == 0 { cfg.Title = defaultTitle } + if len(cfg.Header) == 0 { + cfg.Header = defaultHeader + } + if len(cfg.Header) == 0 { + cfg.Header = defaultLink + } t, err := template.ParseFiles(StaticFolder + "/index.html") if err != nil { return err diff --git a/config/ui/ui_test.go b/config/ui/ui_test.go index 8f5d5d87..c2cbafbe 100644 --- a/config/ui/ui_test.go +++ b/config/ui/ui_test.go @@ -9,10 +9,21 @@ func TestConfig_ValidateAndSetDefaults(t *testing.T) { defer func() { StaticFolder = "./web/static" }() - cfg := &Config{Title: ""} + cfg := &Config{ + Title: "", + Header: "", + Logo: "", + Link: "", + } if err := cfg.ValidateAndSetDefaults(); err != nil { t.Error("expected no error, got", err.Error()) } + if cfg.Title != defaultTitle { + t.Errorf("expected title to be %s, got %s", defaultTitle, cfg.Title) + } + if cfg.Header != defaultHeader { + t.Errorf("expected header to be %s, got %s", defaultHeader, cfg.Header) + } } func TestGetDefaultConfig(t *testing.T) { diff --git a/web/app/public/index.html b/web/app/public/index.html index 7dfd08ef..00be1fab 100644 --- a/web/app/public/index.html +++ b/web/app/public/index.html @@ -3,7 +3,7 @@
f?X(e,i,c,!0,!1,p):I(t,n,r,i,c,s,u,a,p)},q=(e,t,n,r,i,c,s,u,a)=>{let l=0;const f=t.length;let p=e.length-1,d=f-1;while(l<=p&&l<=d){const r=e[l],o=t[l]=a?_t(t[l]):wt(t[l]);if(!lt(r,o))break;w(r,o,n,null,i,c,s,u,a),l++}while(l<=p&&l<=d){const r=e[p],o=t[d]=a?_t(t[d]):wt(t[d]);if(!lt(r,o))break;w(r,o,n,null,i,c,s,u,a),p--,d--}if(l>p){if(l<=d){const e=d+1,o=e f?X(t,i,c,!0,!1,p):I(e,n,r,i,c,s,u,a,p)},G=(t,e,n,r,i,c,s,u,a)=>{let l=0;const f=e.length;let p=t.length-1,d=f-1;while(l<=p&&l<=d){const r=t[l],o=e[l]=a?_e(e[l]):we(e[l]);if(!le(r,o))break;w(r,o,n,null,i,c,s,u,a),l++}while(l<=p&&l<=d){const r=t[p],o=e[d]=a?_e(e[d]):we(e[d]);if(!le(r,o))break;w(r,o,n,null,i,c,s,u,a),p--,d--}if(l>p){if(l<=d){const t=d+1,o=t