Skip to content

Commit a3d3be7

Browse files
committed
backend changes
1 parent 39f42bc commit a3d3be7

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

coderd/entitlements/entitlements.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ 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,
@@ -45,7 +45,7 @@ func New() *Set {
4545

4646
// ErrLicenseRequiresTelemetry is an error returned by a fetch passed to Update to indicate that the
4747
// fetched license cannot be used because it requires telemetry.
48-
var ErrLicenseRequiresTelemetry = xerrors.New("License requires telemetry but telemetry is disabled")
48+
var ErrLicenseRequiresTelemetry = xerrors.New(codersdk.LicenseTelemetryRequiredErrorText)
4949

5050
func (l *Set) Update(ctx context.Context, fetch func(context.Context) (codersdk.Entitlements, error)) error {
5151
select {
@@ -65,6 +65,13 @@ func (l *Set) Update(ctx context.Context, fetch func(context.Context) (codersdk.
6565
// enterprise features enabled.
6666
l.Modify(func(entitlements *codersdk.Entitlements) {
6767
entitlements.Errors = []string{err.Error()}
68+
entitlements.Features = make(map[codersdk.FeatureName]codersdk.Feature)
69+
for _, featureName := range codersdk.FeatureNames {
70+
entitlements.AddFeature(featureName, codersdk.Feature{
71+
Entitlement: codersdk.EntitlementNotEntitled,
72+
Enabled: false,
73+
})
74+
}
6875
})
6976
return nil
7077
}

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)