Skip to content

Commit 29d0ba7

Browse files
committed
separate useLocalApp feature flag for SH users
1 parent 06c0067 commit 29d0ba7

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/experiments.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@ export class ExperimentalSettings {
3333
this.extensionVersion = new semver.SemVer(extensionVersion);
3434
}
3535

36-
async get<T>(key: string, userId?: string, custom?: { [key: string]: string }): Promise<T | undefined> {
36+
async get<T>(
37+
key: string,
38+
userId: string,
39+
custom: {
40+
gitpodHost: string
41+
[key: string]: string
42+
},
43+
// '.' are not allowed in configcat
44+
configcatKey: string = key.replace(/\./g, '_')
45+
): Promise<T | undefined> {
3746
const config = vscode.workspace.getConfiguration('gitpod');
3847
const values = config.inspect<T>(key.substring('gitpod.'.length));
3948
if (!values || !EXPERTIMENTAL_SETTINGS.includes(key)) {
@@ -50,13 +59,21 @@ export class ExperimentalSettings {
5059
}
5160

5261
const user = userId ? new configcatcommon.User(userId, undefined, undefined, custom) : undefined;
53-
const configcatKey = key.replace(/\./g, '_'); // '.' are not allowed in configcat
5462
const experimentValue = (await this.configcatClient.getValueAsync(configcatKey, undefined, user)) as T | undefined;
5563

5664
return experimentValue ?? values.defaultValue;
5765
}
5866

59-
async inspect<T>(key: string, userId?: string, custom?: { [key: string]: string }): Promise<{ key: string; defaultValue?: T; globalValue?: T; experimentValue?: T } | undefined> {
67+
async inspect<T>(
68+
key: string,
69+
userId: string,
70+
custom: {
71+
gitpodHost: string
72+
[key: string]: string
73+
},
74+
// '.' are not allowed in configcat
75+
configcatKey: string = key.replace(/\./g, '_')
76+
): Promise<{ key: string; defaultValue?: T; globalValue?: T; experimentValue?: T } | undefined> {
6077
const config = vscode.workspace.getConfiguration('gitpod');
6178
const values = config.inspect<T>(key.substring('gitpod.'.length));
6279
if (!values || !EXPERTIMENTAL_SETTINGS.includes(key)) {
@@ -65,7 +82,6 @@ export class ExperimentalSettings {
6582
}
6683

6784
const user = userId ? new configcatcommon.User(userId, undefined, undefined, custom) : undefined;
68-
const configcatKey = key.replace(/\./g, '_'); // '.' are not allowed in configcat
6985
const experimentValue = (await this.configcatClient.getValueAsync(configcatKey, undefined, user)) as T | undefined;
7086

7187
return { key, defaultValue: values.defaultValue, globalValue: values.globalValue, experimentValue };

src/remoteConnector.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,10 +788,9 @@ export default class RemoteConnector extends Disposable {
788788

789789
this.logger.info('Opening Gitpod workspace', uri.toString());
790790

791-
// Only use experiment for SaaS
792791
const forceUseLocalApp = getServiceURL(params.gitpodHost) === 'https://gitpod.io'
793792
? (await this.experiments.get<boolean>('gitpod.remote.useLocalApp', session.account.id, { gitpodHost: params.gitpodHost }))!
794-
: vscode.workspace.getConfiguration('gitpod').get<boolean>('remote.useLocalApp')!;
793+
: (await this.experiments.get<boolean>('gitpod.remote.useLocalApp', session.account.id, { gitpodHost: params.gitpodHost }, 'gitpod_remote_useLocalApp_sh'))!
795794
const userOverride = String(isUserOverrideSetting('gitpod.remote.useLocalApp'));
796795
let sshDestination: string | undefined;
797796
if (!forceUseLocalApp) {

0 commit comments

Comments
 (0)