Skip to content

Commit 96abfb8

Browse files
committed
[server] Forward billingTier to ConfigCat
1 parent 9a8c05a commit 96abfb8

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

components/server/src/workspace/workspace-starter.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,9 @@ export class WorkspaceStarter {
826826
}
827827
//#endregion
828828

829+
const billingTier = await this.entitlementService.getBillingTier(user);
830+
const userTeams = await this.teamDB.findTeamsByUser(user.id);
831+
829832
let featureFlags: NamedWorkspaceFeatureFlag[] = workspace.config._featureFlags || [];
830833
featureFlags = featureFlags.concat(this.config.workspaceDefaults.defaultFeatureFlags);
831834
if (user.featureFlags && user.featureFlags.permanentWSFeatureFlags) {
@@ -840,7 +843,13 @@ export class WorkspaceStarter {
840843
);
841844
}
842845

843-
if (await getExperimentsClientForBackend().getValueAsync("protected_secrets", false, { user })) {
846+
if (
847+
await getExperimentsClientForBackend().getValueAsync("protected_secrets", false, {
848+
user,
849+
teams: userTeams,
850+
billingTier,
851+
})
852+
) {
844853
// We roll out the protected secrets feature using a ConfigCat feature flag, to ensure
845854
// a smooth, gradual roll out without breaking users.
846855
featureFlags = featureFlags.concat(["protected_secrets"]);
@@ -859,11 +868,10 @@ export class WorkspaceStarter {
859868
}
860869
}
861870

862-
const userTeams = await this.teamDB.findTeamsByUser(user.id);
863871
const wsConnectionLimitingEnabled = await getExperimentsClientForBackend().getValueAsync(
864872
"workspace_connection_limiting",
865873
false,
866-
{ user, teams: userTeams },
874+
{ user, teams: userTeams, billingTier },
867875
);
868876
if (wsConnectionLimitingEnabled) {
869877
const shouldLimitNetworkConnections = await this.entitlementService.limitNetworkConnections(
@@ -879,6 +887,7 @@ export class WorkspaceStarter {
879887
let classesEnabled = await getExperimentsClientForBackend().getValueAsync("workspace_classes", false, {
880888
user,
881889
teams: userTeams,
890+
billingTier,
882891
});
883892
const usageAttributionId = await this.userService.getWorkspaceUsageAttributionId(user, workspace.projectId);
884893
const billingMode = await this.billingModes.getBillingMode(usageAttributionId, new Date());

0 commit comments

Comments
 (0)