Skip to content

Commit f719a49

Browse files
committed
backend changes
1 parent 39f42bc commit f719a49

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

coderd/entitlements/entitlements.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,30 @@ func New() *Set {
3030
// These will be updated when coderd is initialized.
3131
entitlements: codersdk.Entitlements{
3232
Features: map[codersdk.FeatureName]codersdk.Feature{},
33-
Warnings: nil,
34-
Errors: nil,
33+
Warnings: []string{},
34+
Errors: []string{},
3535
HasLicense: false,
3636
Trial: false,
3737
RequireTelemetry: false,
3838
RefreshedAt: time.Time{},
3939
},
4040
right2Update: make(chan struct{}, 1),
4141
}
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+
}
4250
s.right2Update <- struct{}{} // one token, serialized updates
4351
return s
4452
}
4553

4654
// ErrLicenseRequiresTelemetry is an error returned by a fetch passed to Update to indicate that the
4755
// 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)
4957

5058
func (l *Set) Update(ctx context.Context, fetch func(context.Context) (codersdk.Entitlements, error)) error {
5159
select {

codersdk/licenses.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import (
1212
)
1313

1414
const (
15-
LicenseExpiryClaim = "license_expires"
15+
LicenseExpiryClaim = "license_expires"
16+
LicenseTelemetryRequiredErrorText = "License requires telemetry but telemetry is disabled"
1617
)
1718

1819
type AddLicenseRequest struct {

0 commit comments

Comments
 (0)