@@ -63,6 +63,7 @@ import (
63
63
"github.com/coder/coder/coderd/prometheusmetrics"
64
64
"github.com/coder/coder/coderd/telemetry"
65
65
"github.com/coder/coder/coderd/tracing"
66
+ "github.com/coder/coder/coderd/updatecheck"
66
67
"github.com/coder/coder/codersdk"
67
68
"github.com/coder/coder/cryptorand"
68
69
"github.com/coder/coder/provisioner/echo"
@@ -373,6 +374,25 @@ func Server(vip *viper.Viper, newAPI func(context.Context, *coderd.Options) (*co
373
374
options .TLSCertificates = tlsConfig .Certificates
374
375
}
375
376
377
+ if cfg .UpdateCheck .Value {
378
+ options .UpdateCheckOptions = & updatecheck.Options {
379
+ // Avoid spamming GitHub API checking for updates.
380
+ Interval : 24 * time .Hour ,
381
+ // Inform server admins of new versions.
382
+ Notify : func (r updatecheck.Result ) {
383
+ if semver .Compare (r .Version , buildinfo .Version ()) > 0 {
384
+ options .Logger .Info (
385
+ context .Background (),
386
+ "new version of coder available" ,
387
+ slog .F ("new_version" , r .Version ),
388
+ slog .F ("url" , r .URL ),
389
+ slog .F ("upgrade_instructions" , "https://coder.com/docs/coder-oss/latest/admin/upgrade" ),
390
+ )
391
+ }
392
+ },
393
+ }
394
+ }
395
+
376
396
if cfg .OAuth2 .Github .ClientSecret .Value != "" {
377
397
options .GithubOAuth2Config , err = configureGithubOAuth2 (accessURLParsed ,
378
398
cfg .OAuth2 .Github .ClientID .Value ,
0 commit comments