feat: add support for telemetry-required licenses (#6194)

This commit is contained in:
Ammar Bandukwala
2023-02-14 14:26:47 -06:00
committed by GitHub
parent 15c862fcb5
commit 6e3330a03f
10 changed files with 49 additions and 21 deletions

View File

@ -254,6 +254,17 @@ func (api *API) updateEntitlements(ctx context.Context) error {
if err != nil {
return err
}
if entitlements.RequireTelemetry && !api.DeploymentConfig.Telemetry.Enable.Value {
// We can't fail because then the user couldn't remove the offending
// license w/o a restart.
api.entitlements.Errors = []string{
"License requires telemetry but telemetry is disabled",
}
api.Logger.Error(ctx, "license requires telemetry enabled")
return nil
}
entitlements.Experimental = api.DeploymentConfig.Experimental.Value || len(api.AGPL.Experiments) != 0
featureChanged := func(featureName codersdk.FeatureName) (changed bool, enabled bool) {