Documentation
¶
Overview ¶
Package versioncheck implements a lightweight, opt-out version-check that reports anonymous start telemetry to the Boost OSS telemetry endpoint and notifies the user when a newer poutine release is available.
Index ¶
Constants ¶
const ( // DisableEnv toggles the version check off when set to a truthy value. DisableEnv = "POUTINE_DISABLE_VERSION_CHECK" // URLEnv overrides the compiled-in endpoint, primarily for staging. URLEnv = "POUTINE_VERSION_CHECK_URL" )
Variables ¶
var VersionCheckURL = "https://version-check.cicd.fun/v1/check"
VersionCheckURL is the default endpoint. It can be overridden at runtime via the POUTINE_VERSION_CHECK_URL environment variable, primarily for staging or local testing.
Functions ¶
func ConfigPath ¶
func ConfigPath() string
ConfigPath returns the path to the user-level state file. It honors POUTINE_CONFIG_DIR for tests and constrained environments and otherwise defaults to ~/.poutine/config.yaml.
func SaveConfig ¶
SaveConfig writes the user-level state file, creating the parent directory when needed. The file is written with restrictive permissions because it holds an anonymous instance identifier.
Types ¶
type Config ¶
type Config struct {
InstanceID string `yaml:"instance_id,omitempty"`
StartCount int `yaml:"start_count,omitempty"`
LastReportedStartCount int `yaml:"last_reported_start_count,omitempty"`
LastVersionCheckAt time.Time `yaml:"last_version_check_timestamp,omitempty"`
}
Config is the user-level state persisted between poutine invocations to support the once-per-day version check. It is intentionally separate from the project-level models.Config that is loaded from .poutine.yml.
func LoadConfig ¶
LoadConfig reads the user-level state file. A missing file is not an error and yields a nil Config so callers can treat it as a first run.
type Result ¶
type Result struct {
LatestVersion string `json:"latest_version,omitempty"`
LatestURL string `json:"latest_url,omitempty"`
UpdateAvailable bool `json:"update_available"`
}
Result mirrors the JSON response from the oss-telemetry /v1/check endpoint.