Skip to content
This repository was archived by the owner on Apr 23, 2024. It is now read-only.

Commit 328e824

Browse files
committed
feat: show version on startup and index
1 parent 2070bc2 commit 328e824

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

tmpl/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ <h3>Tags</h3>
3636

3737
<footer>
3838
<hr />
39-
Powered by <a href="https://github.com/saitho/git-file-webserver" target="_blank">Git File Webserver</a>
39+
Powered by <a href="https://github.com/saitho/git-file-webserver" target="_blank">Git File Webserver</a>, version {{ .Version }}
4040
</footer>

webserver/handler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func IndexHandler(client *git.Client) func(resp *Response, req *Request) {
101101
Tags []git.GitTag
102102
LastUpdate time.Time
103103
Client *git.Client
104+
Version string
104105
}
105106

106107
cfg := client.Cfg
@@ -109,6 +110,7 @@ func IndexHandler(client *git.Client) func(resp *Response, req *Request) {
109110
ShowBranches: cfg.Display.Index.ShowBranches,
110111
ShowTags: cfg.Display.Index.ShowTags,
111112
Client: client,
113+
Version: config.VERSION,
112114
})
113115
if err != nil {
114116
log.Errorf("Unable to render index template: %s", err)

webserver/webserver.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"regexp"
66

77
log "github.com/sirupsen/logrus"
8+
9+
"github.com/saitho/static-git-file-server/config"
810
)
911

1012
type Webserver struct {
@@ -27,6 +29,7 @@ func (w *Webserver) Run() {
2729
app.Handle(route)
2830
}
2931

32+
log.Infof("Git File Webserver (version %s) by Mario Lubenka\n", config.VERSION)
3033
log.Infof("Serving with config at %s on HTTP port: %s\n", w.ConfigPath, w.Port)
3134
err := http.ListenAndServe("0.0.0.0:"+w.Port, app)
3235
if err != nil {

0 commit comments

Comments
 (0)