Documentation
¶
Overview ¶
Package updatecheck tells a self-hosted runtime whether a newer release is published: a periodic GET of the project's latest-release address, compared with the running version. It sends nothing but that request.
Index ¶
Constants ¶
const ( // DefaultInterval is the time between checks. DefaultInterval = 12 * time.Hour // Timeout bounds one request. Timeout = 10 * time.Second )
const DefaultURL = "https://api.github.com/repos/ly-solutions/harnessly/releases/latest"
DefaultURL is the project's latest published (non-draft, non-pre-release) release.
Variables ¶
This section is empty.
Functions ¶
func Comparable ¶
Comparable says whether the running version can be compared with a release at all.
Types ¶
type Checker ¶
type Checker struct {
// Current is the running version, as built in ("dev" or unparsable means there is nothing to compare).
Current string
// URL is the latest-release address; empty means DefaultURL.
URL string
// Client makes the request; nil means one that honours the proxy environment and times out.
Client *http.Client
// Interval is the time between checks; zero means DefaultInterval.
Interval time.Duration
// Log gets one line per failed check; may be nil.
Log func(msg string, err error)
// contains filtered or unexported fields
}
Checker asks for the latest release and keeps the answer. Set Current.
func (*Checker) Check ¶
Check makes one request and updates Status. A 304 keeps the previous answer.
type Status ¶
type Status struct {
Current string `json:"current"`
Latest string `json:"latest,omitempty"`
URL string `json:"url,omitempty"`
PublishedAt string `json:"publishedAt,omitempty"`
UpdateAvailable bool `json:"updateAvailable"`
}
Status is what the page is told.