mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Add support for update checks and notifications (#4810)
Co-authored-by: Kira Pilot <kira@coder.com>
This commit is contained in:
co-authored by
Kira Pilot
parent
4f1cf6c9d8
commit
d9f2aaf3b4
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/coder/coder/buildinfo"
|
||||
"github.com/coder/coder/cli/cliui"
|
||||
"github.com/coder/coder/cli/config"
|
||||
"github.com/coder/coder/codersdk"
|
||||
@@ -405,6 +406,12 @@ func newConfig() *codersdk.DeploymentConfig {
|
||||
Usage: "Enable experimental features. Experimental features are not ready for production.",
|
||||
Flag: "experimental",
|
||||
},
|
||||
UpdateCheck: &codersdk.DeploymentConfigField[bool]{
|
||||
Name: "Update Check",
|
||||
Usage: "Periodically check for new releases of Coder and inform the owner. The check is performed once per day.",
|
||||
Flag: "update-check",
|
||||
Default: flag.Lookup("test.v") == nil && !buildinfo.IsDev(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ func TestConfig(t *testing.T) {
|
||||
"CODER_TELEMETRY": "false",
|
||||
"CODER_TELEMETRY_TRACE": "false",
|
||||
"CODER_WILDCARD_ACCESS_URL": "something-wildcard.com",
|
||||
"CODER_UPDATE_CHECK": "false",
|
||||
},
|
||||
Valid: func(config *codersdk.DeploymentConfig) {
|
||||
require.Equal(t, config.Address.Value, "0.0.0.0:8443")
|
||||
@@ -53,6 +54,7 @@ func TestConfig(t *testing.T) {
|
||||
require.Equal(t, config.Telemetry.Enable.Value, false)
|
||||
require.Equal(t, config.Telemetry.Trace.Value, false)
|
||||
require.Equal(t, config.WildcardAccessURL.Value, "something-wildcard.com")
|
||||
require.Equal(t, config.UpdateCheck.Value, false)
|
||||
},
|
||||
}, {
|
||||
Name: "DERP",
|
||||
|
||||
Reference in New Issue
Block a user