Add footer with git revision
This commit is contained in:
parent
30ead637e2
commit
9aa95aba13
@ -86,4 +86,6 @@
|
||||
</form>
|
||||
</details>
|
||||
</nav>
|
||||
|
||||
<footer class="center">rev {{ .Rev }}</footer>
|
||||
{{- end }}
|
||||
|
@ -106,6 +106,7 @@ type SourceData struct {
|
||||
type HomeData struct {
|
||||
Channels []ChannelData
|
||||
Sources []SourceData
|
||||
Rev string
|
||||
}
|
||||
|
||||
func Home(writer io.Writer, data HomeData) {
|
||||
|
@ -101,3 +101,6 @@ span.error-message {
|
||||
#envvars input {
|
||||
font-family: monospace;
|
||||
}
|
||||
footer {
|
||||
opacity: 0.5
|
||||
}
|
||||
|
14
web/root.go
14
web/root.go
@ -2,6 +2,7 @@ package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"runtime/debug"
|
||||
"sort"
|
||||
|
||||
"github.com/Jaculabilis/intake/core"
|
||||
@ -37,9 +38,22 @@ func (env *Env) getRoot(writer http.ResponseWriter, req *http.Request) {
|
||||
channelData = append(channelData, html.ChannelData{Name: name, Active: channels[name]})
|
||||
}
|
||||
|
||||
rev := ""
|
||||
if info, ok := debug.ReadBuildInfo(); ok {
|
||||
for _, setting := range info.Settings {
|
||||
if setting.Key == "vcs.revision" {
|
||||
rev = setting.Value + rev
|
||||
}
|
||||
if setting.Key == "vcs.modified" {
|
||||
rev = rev + "-dirty"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data := html.HomeData{
|
||||
Channels: channelData,
|
||||
Sources: sourceData,
|
||||
Rev: rev,
|
||||
}
|
||||
html.Home(writer, data)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user