File tree Expand file tree Collapse file tree 4 files changed +12
-14
lines changed
Expand file tree Collapse file tree 4 files changed +12
-14
lines changed Original file line number Diff line number Diff line change 11GO ?= go
22PODMAN ?= podman
33
4- GITHASH := $(shell git rev-parse --short HEAD )
4+ GITDESCRIBE := $(shell git describe )
55BUILDTIME := $(shell date -u '+% Y% m% dT% H% M% SZ')
66
7- GOLDFLAGS += -X "github.com/JVMerkle/gemportal/app.gitHash =$(GITHASH ) "
7+ GOLDFLAGS += -X "github.com/JVMerkle/gemportal/app.gitDescribe =$(GITDESCRIBE ) "
88GOLDFLAGS += -X "github.com/JVMerkle/gemportal/app.buildTime=$(BUILDTIME ) "
99GOLDFLAGS += -w -s
1010GOFLAGS += -ldflags "$(GOLDFLAGS ) "
Original file line number Diff line number Diff line change 1919
2020// Injected with linker flags
2121var (
22- gitHash string
23- buildTime string
22+ gitDescribe string
23+ buildTime string
2424)
2525
2626type Config struct {
@@ -47,7 +47,7 @@ func (c *Config) GetAppBuildMeta() string {
4747}
4848
4949// GetConfig loads and checks the application configuration
50- func GetConfig (appVersion string ) (* Config , error ) {
50+ func GetConfig () (* Config , error ) {
5151 var cfg Config
5252
5353 // Load environment variables from a ".env" file, if exists
@@ -58,17 +58,17 @@ func GetConfig(appVersion string) (*Config, error) {
5858 return nil , err
5959 }
6060
61- if len (gitHash ) == 0 || len (buildTime ) == 0 {
62- log .Warn ("Link time definitions missing (GitHash /Buildtime)" )
61+ if len (gitDescribe ) == 0 || len (buildTime ) == 0 {
62+ log .Warn ("Link time definitions missing (gitDescribe /Buildtime)" )
6363 }
6464
6565 if len (cfg .AppDesc ) == 0 {
6666 cfg .AppDesc = template .HTML ("<b>Simple</b> Gemini HTTP portal for port " + cfg .DefaultPort + "." )
6767 }
6868
69- buildMeta := []string {gitHash , buildTime }
69+ buildMeta := []string {gitDescribe , buildTime }
7070
71- cfg .appVersion = appVersion
71+ cfg .appVersion = gitDescribe
7272
7373 for i := 0 ; i < len (buildMeta ); i ++ {
7474 cfg .appBuildMeta += buildMeta [i ]
Original file line number Diff line number Diff line change @@ -16,8 +16,6 @@ import (
1616 "github.com/gorilla/mux"
1717)
1818
19- const AppVersion = "1.0.3"
20-
2119//go:embed static/style.css
2220//go:embed static/app.js
2321var staticFS embed.FS
@@ -26,7 +24,7 @@ var staticFS embed.FS
2624var templateFS embed.FS
2725
2826func main () {
29- cfg , err := app .GetConfig (AppVersion )
27+ cfg , err := app .GetConfig ()
3028 if err != nil {
3129 log .Fatalf ("Could not load config: %s" , err .Error ())
3230 }
Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ <h1><a class="title" href="{{ .Cfg.BaseHREF }}">{{ .Cfg.AppName }}</a></h1>
5151 rel ="noreferrer noopener "> gemportal</ a >
5252 {{ if .Cfg.GetAppBuildMeta }}
5353 < span class ="version "
54- title ="{{ .Cfg.GetAppVersion }}+{{ .Cfg. GetAppBuildMeta }} "> v {{ .Cfg.GetAppVersion }}</ span >
54+ title ="{{ .Cfg.GetAppBuildMeta }} "> {{ .Cfg.GetAppVersion }}</ span >
5555 {{ else }}
56- < span class ="version " title ="{{ .Cfg.GetAppVersion }} "> v {{ .Cfg.GetAppVersion }}</ span >
56+ < span class ="version " title ="{{ .Cfg.GetAppVersion }} "> {{ .Cfg.GetAppVersion }}</ span >
5757 {{ end }}
5858</ footer >
5959</ body >
You can’t perform that action at this time.
0 commit comments