lockserver/config/version.go
Finn f90a7cd66d
All checks were successful
/ build-container (push) Successful in 8m40s
Frontend: put version number in static URL to cache-bust on updates
2025-02-23 14:48:35 -08:00

34 lines
474 B
Go

package config
import (
"runtime/debug"
"github.com/sirupsen/logrus"
)
var (
BuildInfo *debug.BuildInfo
Version string
)
func init() {
var ok bool
BuildInfo, ok = debug.ReadBuildInfo()
if !ok {
logrus.Error("failed to read build info")
return
}
if Version == "" {
for _, setting := range BuildInfo.Settings {
if setting.Key == "vcs.revision" {
Version = setting.Value
break
}
}
if Version == "" {
Version = "development"
}
}
}