@@ -135,7 +135,13 @@ type Options struct {
135
135
AccessControlStore * atomic.Pointer [dbauthz.AccessControlStore ]
136
136
// AppSecurityKey is the crypto key used to sign and encrypt tokens related to
137
137
// workspace applications. It consists of both a signing and encryption key.
138
- AppSecurityKey workspaceapps.SecurityKey
138
+ AppSecurityKey workspaceapps.SecurityKey
139
+
140
+ // The following two functions are dependencies of HealthcheckFunc but are only implemented
141
+ // in enterprise. Stubbing them out here.
142
+ FetchWorkspaceProxiesFunc * atomic.Pointer [func (context.Context ) (codersdk.RegionsResponse [codersdk.WorkspaceProxy ], error )]
143
+ UpdateProxyHealthFunc * atomic.Pointer [func (context.Context ) error ]
144
+
139
145
HealthcheckFunc func (ctx context.Context , apiKey string ) * healthcheck.Report
140
146
HealthcheckTimeout time.Duration
141
147
HealthcheckRefresh time.Duration
@@ -396,6 +402,15 @@ func New(options *Options) *API {
396
402
* options .UpdateCheckOptions ,
397
403
)
398
404
}
405
+
406
+ if options .FetchWorkspaceProxiesFunc == nil {
407
+ options .FetchWorkspaceProxiesFunc = & atomic.Pointer [func (context.Context ) (codersdk.RegionsResponse [codersdk.WorkspaceProxy ], error )]{}
408
+ }
409
+
410
+ if options .UpdateProxyHealthFunc == nil {
411
+ options .UpdateProxyHealthFunc = & atomic.Pointer [func (context.Context ) error ]{}
412
+ }
413
+
399
414
if options .HealthcheckFunc == nil {
400
415
options .HealthcheckFunc = func (ctx context.Context , apiKey string ) * healthcheck.Report {
401
416
return healthcheck .Run (ctx , & healthcheck.ReportOptions {
@@ -413,9 +428,15 @@ func New(options *Options) *API {
413
428
DerpHealth : derphealth.ReportOptions {
414
429
DERPMap : api .DERPMap (),
415
430
},
431
+ WorkspaceProxy : healthcheck.WorkspaceProxyReportOptions {
432
+ CurrentVersion : buildinfo .Version (),
433
+ FetchWorkspaceProxies : * options .FetchWorkspaceProxiesFunc .Load (),
434
+ UpdateProxyHealth : * options .UpdateProxyHealthFunc .Load (),
435
+ },
416
436
})
417
437
}
418
438
}
439
+
419
440
if options .HealthcheckTimeout == 0 {
420
441
options .HealthcheckTimeout = 30 * time .Second
421
442
}
0 commit comments