mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
feat: add port-sharing backend (#11939)
This commit is contained in:
@ -15,6 +15,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/appearance"
|
||||
agplportsharing "github.com/coder/coder/v2/coderd/portsharing"
|
||||
"github.com/coder/coder/v2/enterprise/coderd/portsharing"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
"tailscale.com/tailcfg"
|
||||
@ -533,6 +535,7 @@ func (api *API) updateEntitlements(ctx context.Context) error {
|
||||
codersdk.FeatureWorkspaceProxy: true,
|
||||
codersdk.FeatureUserRoleManagement: true,
|
||||
codersdk.FeatureAccessControl: true,
|
||||
codersdk.FeatureControlSharedPorts: true,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@ -690,6 +693,14 @@ func (api *API) updateEntitlements(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
if initial, changed, enabled := featureChanged(codersdk.FeatureControlSharedPorts); shouldUpdate(initial, changed, enabled) {
|
||||
var ps agplportsharing.PortSharer = agplportsharing.DefaultPortSharer
|
||||
if enabled {
|
||||
ps = portsharing.NewEnterprisePortSharer()
|
||||
}
|
||||
api.AGPL.PortSharer.Store(&ps)
|
||||
}
|
||||
|
||||
// External token encryption is soft-enforced
|
||||
featureExternalTokenEncryption := entitlements.Features[codersdk.FeatureExternalTokenEncryption]
|
||||
featureExternalTokenEncryption.Enabled = len(api.ExternalTokenEncryption) > 0
|
||||
|
Reference in New Issue
Block a user