diff options
| author | Shulhan <ms@kilabit.info> | 2026-01-22 14:00:27 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-01-22 14:07:20 +0700 |
| commit | b20dc5c85b418b7167b3fb7866c7ea9a9fa0a705 (patch) | |
| tree | 9305a5da1d82df61c342d12b7f3c47ab2e8a3b2e | |
| parent | dcf27b411a29f29a0afff161fec8e0364e1cce2c (diff) | |
| download | lilin-b20dc5c85b418b7167b3fb7866c7ea9a9fa0a705.tar.xz | |
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.
| -rw-r--r-- | _www/index.tmpl | 10 | ||||
| -rw-r--r-- | server_config.go | 2 | ||||
| -rw-r--r-- | testdata/etc/lilin/lilin.cfg | 1 | ||||
| -rw-r--r-- | 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> </head> <style> - h2 { + h3 { background-color: papayawhip; padding-left: 1em; } @@ -48,9 +48,9 @@ } </style> <body> - <h1>{{.Title}}</h1> + <h2>{{.Title}}</h2> - <h2>Service status</h2> + <h3>Service status</h3> <div class="service-status"> <div class="service header"> <span class="at">At</span> @@ -69,12 +69,11 @@ {{ end }} </div> - <h2>Down history</h2> + <h3>Down history</h3> <div class="down-history"> <div class="service header"> <span class="at">At</span> <span class="sid">Service</span> - <span class="status">Status</span> <span class="error">Error</span> </div> {{ $list := reverse .Fail }} @@ -82,7 +81,6 @@ <div class="service"> <span class="at">{{ .At }}</span> <span class="sid">{{ .ID }}</span> - <span class="status"><span class="fail"> DOWN </span></span> <span class="error">{{ .Error }}</span> </div> {{ 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 @@ -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 { |
