Show running version on the dashboard footer#46
Merged
Conversation
Surface the build-time version (main.version, set via -ldflags) so it is visible from the web UI instead of only via the --version CLI flag. - Thread the version from main into the HTTP server and expose it additively as a version field on GET /api/v1/config (no change to existing response shapes). - Render it in the dashboard footer, between the PiMonitor label and the API link. A release is tagged vX.Y.Z, so a leading v is stripped for display; unversioned local builds show dev. - Embed the version in install.sh's local-build fallback via git describe, mirroring the Makefile and GoReleaser, so on-Pi builds report a real version too. - Document the new config field in docs/API.md and cover it in the config handler test. Closes #45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The dashboard now shows which PiMonitor version is running, so you can tell from the web UI what's deployed (useful after an upgrade or when triaging a report). The build-time
main.version(already set via-ldflags, previously only reachable through the--versionCLI flag) is threaded into the HTTP server and surfaced in the footer.versionfield toGET /api/v1/config(additive — no change to existing response shapes).cmd/pimonitor/main.gopassesmain.versionthrough tohttpapi.ClientConfig.PiMonitorlabel and the/api/v1/metricslink. Releases are taggedvX.Y.Z; the frontend strips the leadingvfor display (e.g.v1.2.3→1.2.3), while an unversioned local build showsdevunchanged.git describe --tags --always --dirtyand-ldflags, mirroring theMakefileand GoReleaser, so binaries built directly on the Pi report a real version too (falling back todevoutside a git checkout).docs/API.mddocuments the newversionfield.Verified end-to-end: built with
-X main.version=v1.2.3,GET /api/v1/configreturns"version":"v1.2.3", and the served footer fills in1.2.3.Related Issue
Closes #45
Checklist
go test ./...passes locally)go vet ./...andgolangci-lint runare cleandocs/API.md),configuration (
README.md,packaging/pimonitor.example.yaml), orinstallation/packaging (
packaging/install.sh, systemd units)/api/v1/...response shapes, or a new APIversion was introduced instead