Vary title for executable
This commit is contained in:
parent
2d8897768b
commit
15621ec7e0
3 changed files with 14 additions and 4 deletions
|
@ -14,6 +14,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -38,8 +39,14 @@ var (
|
|||
}
|
||||
return fmt.Sprintf("%s (uid=%s)", user.Username, user.Uid)
|
||||
}()
|
||||
exepath, _ = os.Executable()
|
||||
startTime = time.Now()
|
||||
exepath, exename = func() (string, string) {
|
||||
exe, _ := os.Executable()
|
||||
if exe == "" {
|
||||
return "(unknown)", "(unknown)"
|
||||
}
|
||||
return exe, filepath.Base(exe)
|
||||
}()
|
||||
startTime = time.Now()
|
||||
|
||||
rootItem = &simpleItem{
|
||||
baseItem: baseItem{
|
||||
|
@ -63,6 +70,7 @@ type statusData struct {
|
|||
Build string
|
||||
Hostname string
|
||||
Username string
|
||||
ExeName string
|
||||
ExePath string
|
||||
PID int
|
||||
Compiler string
|
||||
|
@ -191,6 +199,7 @@ func Handle(w http.ResponseWriter, r *http.Request) {
|
|||
Build: "TODO",
|
||||
Hostname: hostname,
|
||||
Username: username,
|
||||
ExeName: exename,
|
||||
ExePath: exepath,
|
||||
PID: os.Getpid(),
|
||||
Compiler: runtime.Compiler,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Status</title>
|
||||
<title>Status for {{.ExeName}}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
|
@ -62,7 +62,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Status</h1>
|
||||
<h1>Status for {{.ExeName}}</h1>
|
||||
<div class="summary">
|
||||
{{.ExePath}}<br>
|
||||
Started at {{.StartTime}} ({{.StartTimeAgo}} ago)<br>
|
||||
|
|
|
@ -47,6 +47,7 @@ func TestSmokeStatusTemplate(t *testing.T) {
|
|||
Build: "1234",
|
||||
Hostname: hostname,
|
||||
Username: username,
|
||||
ExeName: exename,
|
||||
ExePath: exepath,
|
||||
PID: os.Getpid(),
|
||||
Compiler: runtime.Compiler,
|
||||
|
|
Loading…
Reference in a new issue