feat: bake version into binary and display in UI sidebar
- Inject VERSION via ldflags (-X main=web.Version=) and git short SHA
- Add /api/version endpoint returning {version, commit}
- Display version in Layout sidebar footer (v0.1.6 · 8cfd405)
- Add AGENTS.md section documenting SemVer policy and bump-before-push rule
- Bump VERSION 0.1.5 -> 0.1.6 in Makefile
This commit is contained in:
@@ -37,6 +37,13 @@ func (s *Server) handleSystemStatus(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, status)
|
||||
}
|
||||
|
||||
func (s *Server) handleVersion(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, map[string]string{
|
||||
"version": Version,
|
||||
"commit": Commit,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) collectDiskUsage() []diskUsage {
|
||||
entries := make(map[string]*diskUsage)
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ func NewRouter(s *Server) chi.Router {
|
||||
protected.Post("/apply", s.handleApply)
|
||||
protected.Get("/apply/log", s.handleApplyLog)
|
||||
protected.Get("/system/status", s.handleSystemStatus)
|
||||
protected.Get("/version", s.handleVersion)
|
||||
protected.Put("/auth/password", s.handleChangePassword)
|
||||
|
||||
protected.Get("/import/status", s.handleImportStatus)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package web
|
||||
|
||||
var (
|
||||
Version = "dev"
|
||||
Commit = ""
|
||||
)
|
||||
|
||||
func SetVersionInfo(v, c string) {
|
||||
Version = v
|
||||
Commit = c
|
||||
}
|
||||
Reference in New Issue
Block a user