Documentation
¶
Overview ¶
Package updates asks GitHub for the latest Buggregator server release so the UI can say that a new version is out.
One GET of releases/latest at start and then every interval (12 h by default); a failed check waits an hour, never less. The check is optional: it never blocks start, only logs at debug level, and makes no network call when switched off or when the running build has no release version (dev).
Index ¶
Constants ¶
const (
DefaultInterval = 12 * time.Hour
)
const LatestURL = "https://api.github.com/repos/buggregator/server/releases/latest"
LatestURL is the GitHub API for the newest published (non-draft, non-prerelease) server release.
Variables ¶
var ErrNotRelease = errors.New("not a release build")
ErrNotRelease is CheckNow's answer for a build without a release version.
Functions ¶
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker keeps the result of the last successful check.
func New ¶
New returns a checker for the running version. interval <= 0 means the default; anything below an hour is raised to an hour.
func (*Checker) Release ¶ added in v2.11.0
Release returns the notes and assets of the last successful check.
func (*Checker) Run ¶
Run checks at once and then on schedule until ctx ends. A build without a release version (dev) never checks.
type Release ¶ added in v2.11.0
Release is what self-update needs from the last successful check: the notes and the download URL of each asset by name.
type Status ¶
type Status struct {
Current string `json:"current"`
Latest string `json:"latest,omitempty"` // newest release, without a leading v
URL string `json:"url,omitempty"` // its release page
Available bool `json:"available"` // Latest is newer than Current
CheckedAt *time.Time `json:"checked_at,omitempty"` // last successful check
}
Status is what the UI reads.