Skip to content

Commit 3ed1465

Browse files
geroplroboquat
authored andcommitted
[server] Forward billingTier to ConfigCat
1 parent 57a61f4 commit 3ed1465

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,9 @@ export class WorkspaceStarter {
823823
}
824824
//#endregion
825825

826+
const billingTier = await this.entitlementService.getBillingTier(user);
827+
const userTeams = await this.teamDB.findTeamsByUser(user.id);
828+
826829
let featureFlags: NamedWorkspaceFeatureFlag[] = workspace.config._featureFlags || [];
827830
featureFlags = featureFlags.concat(this.config.workspaceDefaults.defaultFeatureFlags);
828831
if (user.featureFlags && user.featureFlags.permanentWSFeatureFlags) {
@@ -842,19 +845,24 @@ export class WorkspaceStarter {
842845
);
843846
}
844847

845-
if (await getExperimentsClientForBackend().getValueAsync("protected_secrets", false, { user })) {
848+
if (
849+
await getExperimentsClientForBackend().getValueAsync("protected_secrets", false, {
850+
user,
851+
teams: userTeams,
852+
billingTier,
853+
})
854+
) {
846855
// We roll out the protected secrets feature using a ConfigCat feature flag, to ensure
847856
// a smooth, gradual roll out without breaking users.
848857
featureFlags = featureFlags.concat(["protected_secrets"]);
849858
}
850859

851860
featureFlags = featureFlags.filter((f) => !excludeFeatureFlags.includes(f));
852861

853-
const userTeams = await this.teamDB.findTeamsByUser(user.id);
854862
const wsConnectionLimitingEnabled = await getExperimentsClientForBackend().getValueAsync(
855863
"workspace_connection_limiting",
856864
false,
857-
{ user, teams: userTeams },
865+
{ user, teams: userTeams, billingTier },
858866
);
859867
if (wsConnectionLimitingEnabled) {
860868
const shouldLimitNetworkConnections = await this.entitlementService.limitNetworkConnections(
@@ -870,6 +878,7 @@ export class WorkspaceStarter {
870878
let classesEnabled = await getExperimentsClientForBackend().getValueAsync("workspace_classes", false, {
871879
user,
872880
teams: userTeams,
881+
billingTier,
873882
});
874883
const usageAttributionId = await this.userService.getWorkspaceUsageAttributionId(user, workspace.projectId);
875884
const billingMode = await this.billingModes.getBillingMode(usageAttributionId, new Date());

0 commit comments

Comments
 (0)