Repository navigation
feat: check GitHub for a new server release and expose it in /api/settings - #406
Merged
Merged
Conversation
…tings
The server asks api.github.com for buggregator/server releases/latest at
start and every 12 h (update_check.interval, at least 1 h; a failed check
waits 1 h, 10 s timeout, last good result kept). GET /api/settings gains
"update": {current, latest, url, available, checked_at}, null when the
check is off. update_check.enabled / UPDATE_CHECK_ENABLED=false makes no
network call; a dev build never checks.
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.
What
Server side of #6 («new version available»).
internal/updates:GET https://api.github.com/repos/buggregator/server/releases/latestat start and everyupdate_check.interval(default12h, raised to at least1h). 10 s timeout,User-Agent: buggregator/<version>, body capped at 1 MB. A failed check is logged at debug level, keeps the last good result and waits 1 h — no retry storm (60 req/h unauthenticated GitHub limit is never near).GET /api/settings(public, the UI already reads it) gainsupdate:latest/url/checked_atabsent until the first successful check;updateisnullwhen the check is off.update_check.enabled(envUPDATE_CHECK_ENABLED, defaulttrue;false= no network call at all),update_check.interval(envUPDATE_CHECK_INTERVAL). Adevbuild (no release version) never calls GitHub.major.minor.patch, leadingvignored, a release is newer than its own pre-release.Tests
internal/updates: version compare table; check against a fake GitHub (newer / same); failures (403, bad JSON, non-version tag) keep the last result;Runretries after a failure and does not re-check after a success; dev build makes no request; interval floor.TestAPI_SettingsUpdate:updateisnullwhen off, the status object when on.go vet+go test -race -count=1 ./internal/updates/ ./internal/app/ ./internal/server/http/ok.2.6.0→ latest2.7.0,available: true; current2.7.0→available: false.Frontend notice comes in a separate frontend PR.
Made with harnsy