Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RollbackError ¶
RollbackError takes an error value returned by Apply and returns the error, if any, that occurred when attempting to roll back from a failed update. Applications should always call this function on any non-nil errors returned by Apply.
If no rollback was needed or if the rollback was successful, RollbackError returns nil, otherwise it returns the error encountered when trying to roll back.
Types ¶
type Config ¶
type Config struct { TargetFile string SourceRepo string Version string CurrentVersion string PublicKey []byte Log logrus.StdLogger OperatingSystem string Architecture string Downloader Downloader }
Config configures the updater
type Downloader ¶
type Downloader interface { Configure(*Config) error FetchSpec() (*Spec, error) FetchBinary(spec *Spec, target string) error }
Downloader can download releases from repositories
type HTTPDownloader ¶
type HTTPDownloader struct {
// contains filtered or unexported fields
}
HTTPDownloader downloads releases from a normal HTTP(S) server
The update directory structure is:
root/<Version>/<OperatingSystem>/<Architecture>/release.json
func (*HTTPDownloader) Configure ¶
func (h *HTTPDownloader) Configure(c *Config) error
Configure implements Downloader
func (*HTTPDownloader) FetchBinary ¶
func (h *HTTPDownloader) FetchBinary(spec *Spec, target string) error
FetchBinary implements Downloader
func (*HTTPDownloader) FetchSpec ¶
func (h *HTTPDownloader) FetchSpec() (spec *Spec, err error)
FetchSpec implements Downloader
type Option ¶
Option is a function that configures the auto updater
func CurrentVersion ¶
CurrentVersion sets the current version of the app and allows for an early exit if update is not needed, always updates when not set
func DownloadMethod ¶
func DownloadMethod(m Downloader) Option
DownloadMethod configures a downloader to use