@@ -31,6 +31,9 @@ import { HostContextProvider } from "../auth/host-context-provider";
31
31
import { AuthorizationService } from "../user/authorization-service" ;
32
32
import { TraceContext } from "@gitpod/gitpod-protocol/lib/util/tracing" ;
33
33
import { Config } from "../config" ;
34
+ import { EntitlementService } from "../billing/entitlement-service" ;
35
+ import { getExperimentsClientForBackend } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server" ;
36
+ import { TeamDB } from "@gitpod/gitpod-db/lib" ;
34
37
35
38
const POD_PATH_WORKSPACE_BASE = "/workspace" ;
36
39
@@ -48,6 +51,8 @@ export class ConfigProvider {
48
51
@inject ( AuthorizationService ) protected readonly authService : AuthorizationService ;
49
52
@inject ( Config ) protected readonly config : Config ;
50
53
@inject ( ConfigurationService ) protected readonly configurationService : ConfigurationService ;
54
+ @inject ( EntitlementService ) protected readonly entitlementService : EntitlementService ;
55
+ @inject ( TeamDB ) protected readonly teamDB : TeamDB ;
51
56
52
57
public async fetchConfig (
53
58
ctx : TraceContext ,
@@ -129,6 +134,18 @@ export class ConfigProvider {
129
134
NamedWorkspaceFeatureFlag . isWorkspacePersisted ,
130
135
) ;
131
136
}
137
+ const billingTier = await this . entitlementService . getBillingTier ( user ) ;
138
+ const userTeams = await this . teamDB . findTeamsByUser ( user . id ) ;
139
+ // this allows to control user`s PVC feature flag via ConfigCat
140
+ if (
141
+ await getExperimentsClientForBackend ( ) . getValueAsync ( "user_pvc" , false , {
142
+ user,
143
+ teams : userTeams ,
144
+ billingTier,
145
+ } )
146
+ ) {
147
+ config . _featureFlags = ( config . _featureFlags || [ ] ) . concat ( [ "persistent_volume_claim" ] ) ;
148
+ }
132
149
133
150
return { config, literalConfig } ;
134
151
} catch ( e ) {
0 commit comments