File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -30,22 +30,30 @@ func New() *Set {
30
30
// These will be updated when coderd is initialized.
31
31
entitlements : codersdk.Entitlements {
32
32
Features : map [codersdk.FeatureName ]codersdk.Feature {},
33
- Warnings : nil ,
34
- Errors : nil ,
33
+ Warnings : [] string {} ,
34
+ Errors : [] string {} ,
35
35
HasLicense : false ,
36
36
Trial : false ,
37
37
RequireTelemetry : false ,
38
38
RefreshedAt : time.Time {},
39
39
},
40
40
right2Update : make (chan struct {}, 1 ),
41
41
}
42
+ // Ensure all features are present in the entitlements. Our frontend
43
+ // expects this.
44
+ for _ , featureName := range codersdk .FeatureNames {
45
+ s .entitlements .AddFeature (featureName , codersdk.Feature {
46
+ Entitlement : codersdk .EntitlementNotEntitled ,
47
+ Enabled : false ,
48
+ })
49
+ }
42
50
s .right2Update <- struct {}{} // one token, serialized updates
43
51
return s
44
52
}
45
53
46
54
// ErrLicenseRequiresTelemetry is an error returned by a fetch passed to Update to indicate that the
47
55
// fetched license cannot be used because it requires telemetry.
48
- var ErrLicenseRequiresTelemetry = xerrors .New ("License requires telemetry but telemetry is disabled" )
56
+ var ErrLicenseRequiresTelemetry = xerrors .New (codersdk . LicenseTelemetryRequiredErrorText )
49
57
50
58
func (l * Set ) Update (ctx context.Context , fetch func (context.Context ) (codersdk.Entitlements , error )) error {
51
59
select {
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ import (
12
12
)
13
13
14
14
const (
15
- LicenseExpiryClaim = "license_expires"
15
+ LicenseExpiryClaim = "license_expires"
16
+ LicenseTelemetryRequiredErrorText = "License requires telemetry but telemetry is disabled"
16
17
)
17
18
18
19
type AddLicenseRequest struct {
You can’t perform that action at this time.
0 commit comments