Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAutoUpdateUnsupportedInOfficialContainer = errors.New("auto-update unsupported in official Fossorial container images")
ErrAutoUpdateUnsupportedInOfficialContainer indicates auto-update is not available when running inside official Fossorial container images.
Functions ¶
func CheckAndSelfUpdate ¶ added in v1.13.0
func CheckAndSelfUpdate(cfg SelfUpdateConfig) error
CheckAndSelfUpdate contacts the pangolin server, checks whether a newer version of newt is available, downloads it if so, replaces the running binary on disk, and re-executes from the new binary.
It returns an error when the check or update fails. On a successful update the function does not return – the process is replaced by the new binary via syscall.Exec.
func CheckForUpdate ¶
CheckForUpdate checks the Fossorial versions API for a newer version and prints an update banner if found.
Types ¶
type SelfUpdateConfig ¶ added in v1.13.0
type SelfUpdateConfig struct {
// Endpoint is the base URL of the pangolin server (e.g. "https://app.pangolin.net")
Endpoint string
// NewtID is the newt client identifier used for authentication.
NewtID string
// Secret is the newt client secret used for authentication.
Secret string
// CurrentVersion is the version of the currently running binary.
CurrentVersion string
// Platform is the OS+arch string embedded at build time via ldflags
// (e.g. "linux_amd64", "darwin_arm64"). When non-empty it is used
// directly; when empty the value is derived from runtime.GOOS/GOARCH.
Platform string
// TLSConfig is an optional TLS configuration for the HTTP client (may be nil).
TLSConfig *tls.Config
}
SelfUpdateConfig holds the configuration required to perform a self-update.
type VersionsAPIEntry ¶ added in v1.14.0
type VersionsAPIEntry struct {
LatestVersion string `json:"latestVersion"`
ReleaseNotes string `json:"releaseNotes"`
}
VersionsAPIEntry represents one component's version payload.
type VersionsAPIResponse ¶ added in v1.14.0
type VersionsAPIResponse struct {
Data map[string]VersionsAPIEntry `json:"data"`
Success bool `json:"success"`
Error bool `json:"error"`
Message string `json:"message"`
Status int `json:"status"`
}
VersionsAPIResponse represents the versions API response.