21 lines
635 B
Go
21 lines
635 B
Go
package http
|
|
|
|
import (
|
|
"encoding/json"
|
|
stdhttp "net/http"
|
|
|
|
"gitea.dcglab.co.uk/steve/restic-manager/internal/version"
|
|
)
|
|
|
|
// handleVersion exposes the server's build-time identifying constants
|
|
// (set via -ldflags). Public-band — no secrets surface here, the agent
|
|
// updater compares its own agent_version byte-for-byte against the
|
|
// Version field to drive the "out of date" signal.
|
|
func (s *Server) handleVersion(w stdhttp.ResponseWriter, r *stdhttp.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
_ = json.NewEncoder(w).Encode(map[string]string{
|
|
"version": version.Version,
|
|
"commit": version.Commit,
|
|
})
|
|
}
|