updatecheck

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package updatecheck provides a mechanism for periodically checking for updates to Coder.

The update check is performed by querying the GitHub API for the latest release of Coder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	// contains filtered or unexported fields
}

Checker is responsible for periodically checking for updates.

func New

func New(db database.Store, log slog.Logger, opts Options) *Checker

New returns a new Checker that periodically checks for Coder updates.

func (*Checker) Close

func (c *Checker) Close() error

func (*Checker) Latest

func (c *Checker) Latest(ctx context.Context) (r Result, err error)

Latest returns the latest version of Coder.

type Options

type Options struct {
	// Client is the HTTP client to use for the update check,
	// if omitted, http.DefaultClient will be used.
	Client *http.Client
	// URL is the URL to check for the latest version of Coder,
	// if omitted, the default URL will be used.
	URL string
	// Interval is the interval at which to check for updates,
	// default 24h.
	Interval time.Duration
	// UpdateTimeout sets the timeout for the update check,
	// default 30s.
	UpdateTimeout time.Duration
	// Notify is called when a newer version of Coder (than the
	// last update check) is available.
	Notify func(r Result)
}

Options set optional parameters for the update check.

type Result

type Result struct {
	Checked time.Time `json:"checked,omitempty"`
	Version string    `json:"version,omitempty"`
	URL     string    `json:"url,omitempty"`
}

Result is the result from the last update check.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL