From b20dc5c85b418b7167b3fb7866c7ea9a9fa0a705 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 22 Jan 2026 14:00:27 +0700 Subject: all: add option to set custom Title on server configuration The title will be displayed for window title and as the heading in the status page. While at it, remove the status column on the Down History section, since the value is static. --- _www/index.tmpl | 10 ++++------ server_config.go | 2 ++ testdata/etc/lilin/lilin.cfg | 1 + worker.go | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/_www/index.tmpl b/_www/index.tmpl index 6632569..d4eb63e 100644 --- a/_www/index.tmpl +++ b/_www/index.tmpl @@ -6,7 +6,7 @@ {{.Title}} -

{{.Title}}

+

{{.Title}}

-

Service status

+

Service status

At @@ -69,12 +69,11 @@ {{ end }}
-

Down history

+

Down history

At Service - Status Error
{{ $list := reverse .Fail }} @@ -82,7 +81,6 @@
{{ .At }} {{ .ID }} - DOWN {{ .Error }}
{{ end }} diff --git a/server_config.go b/server_config.go index 2a320a2..ddbb742 100644 --- a/server_config.go +++ b/server_config.go @@ -35,6 +35,8 @@ type ServerConfig struct { DownTemplate string `ini:"default::down_template"` UpTemplate string `ini:"default::up_template"` + Title string `ini:"server::title"` + // The address to listen for HTTP server and APIs. Address string `ini:"server::address"` diff --git a/testdata/etc/lilin/lilin.cfg b/testdata/etc/lilin/lilin.cfg index c2f03c3..737dd2d 100644 --- a/testdata/etc/lilin/lilin.cfg +++ b/testdata/etc/lilin/lilin.cfg @@ -2,5 +2,6 @@ ## SPDX-License-Identifier: GPL-3.0-only [server] +title = Service status for Example address = 127.0.0.1:6101 default_timeout = 5s diff --git a/worker.go b/worker.go index b39b047..b5b8e97 100644 --- a/worker.go +++ b/worker.go @@ -55,6 +55,7 @@ func newWorker(cfg ServerConfig) (wrk *worker, err error) { } wrk.Reports = Reports{ + Title: cfg.Title, Services: make(map[string]*ServiceReport, len(wrk.Services)), } for id := range wrk.Services { -- cgit v1.3