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