Add footer with git revision
This commit is contained in:
parent
30ead637e2
commit
9aa95aba13
@ -86,4 +86,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</details>
|
</details>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<footer class="center">rev {{ .Rev }}</footer>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -106,6 +106,7 @@ type SourceData struct {
|
|||||||
type HomeData struct {
|
type HomeData struct {
|
||||||
Channels []ChannelData
|
Channels []ChannelData
|
||||||
Sources []SourceData
|
Sources []SourceData
|
||||||
|
Rev string
|
||||||
}
|
}
|
||||||
|
|
||||||
func Home(writer io.Writer, data HomeData) {
|
func Home(writer io.Writer, data HomeData) {
|
||||||
|
@ -101,3 +101,6 @@ span.error-message {
|
|||||||
#envvars input {
|
#envvars input {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
footer {
|
||||||
|
opacity: 0.5
|
||||||
|
}
|
||||||
|
14
web/root.go
14
web/root.go
@ -2,6 +2,7 @@ package web
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"runtime/debug"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/Jaculabilis/intake/core"
|
"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]})
|
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{
|
data := html.HomeData{
|
||||||
Channels: channelData,
|
Channels: channelData,
|
||||||
Sources: sourceData,
|
Sources: sourceData,
|
||||||
|
Rev: rev,
|
||||||
}
|
}
|
||||||
html.Home(writer, data)
|
html.Home(writer, data)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user