feat: default update channel

This commit is contained in:
James Houlahan
2021-02-05 12:06:57 +01:00
parent 5c9e9caa2f
commit 4ab5635293
2 changed files with 6 additions and 2 deletions

View File

@ -27,3 +27,7 @@ const (
// EarlyChannel is the channel users subscribe to when they enable "Early Access". // EarlyChannel is the channel users subscribe to when they enable "Early Access".
EarlyChannel UpdateChannel = "early" EarlyChannel UpdateChannel = "early"
) )
// DefaultUpdateChannel is the default update channel to subscribe to.
// It is set to the stable channel by default, unless overridden at build time.
var DefaultUpdateChannel = StableChannel // nolint[gochecknoglobals]

View File

@ -66,10 +66,10 @@ func New(
curVer *semver.Version, curVer *semver.Version,
updateURLName, platform string, updateURLName, platform string,
) *Updater { ) *Updater {
// If there's some unexpected value in the preferences, we force it back onto the stable channel. // If there's some unexpected value in the preferences, we force it back onto the default channel.
// This prevents users from screwing up silent updates by modifying their prefs.json file. // This prevents users from screwing up silent updates by modifying their prefs.json file.
if channel := UpdateChannel(s.Get(settings.UpdateChannelKey)); !(channel == StableChannel || channel == EarlyChannel) { if channel := UpdateChannel(s.Get(settings.UpdateChannelKey)); !(channel == StableChannel || channel == EarlyChannel) {
s.Set(settings.UpdateChannelKey, string(StableChannel)) s.Set(settings.UpdateChannelKey, string(DefaultUpdateChannel))
} }
return &Updater{ return &Updater{