Skip to content

Commit c3bbcb1

Browse files
Merge pull request #61 from gitpod-io/ft/dynamic-experiments-host
2 parents e9aedea + e1b92bb commit c3bbcb1

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
},
131131
"main": "./out/extension.js",
132132
"segmentKey": "YErmvd89wPsrCuGcVnF2XAl846W9WIGl",
133-
"configcatKey": "WBLaCPtkjkqKHlHedziE9g/LEAOCNkbuUKiqUZAcVg7dw",
133+
"configcatKey": "gitpod",
134134
"scripts": {
135135
"vscode:prepublish": "webpack --mode production",
136136
"webpack": "webpack --mode development",

src/experiments.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as configcatcommon from 'configcat-common';
99
import * as semver from 'semver';
1010
import { ISessionService } from './services/sessionService';
1111
import { ILogService } from './services/logService';
12+
import { IHostService } from './services/hostService';
1213

1314
const EXPERTIMENTAL_SETTINGS = [
1415
'gitpod.remote.useLocalApp',
@@ -23,11 +24,10 @@ export class ExperimentalSettings {
2324
key: string,
2425
extensionVersion: string,
2526
private readonly sessionService: ISessionService,
26-
private readonly context: vscode.ExtensionContext,
27+
private readonly hostService: IHostService,
2728
private readonly logger: ILogService
2829
) {
29-
this.configcatClient = configcat.createClientWithLazyLoad(key, {
30-
baseUrl: new URL('/configcat', this.context.extensionMode === vscode.ExtensionMode.Production ? 'https://gitpod.io' : 'https://gitpod-staging.com').href,
30+
const configCatOptions = {
3131
logger: {
3232
debug(): void { },
3333
log(): void { },
@@ -37,7 +37,20 @@ export class ExperimentalSettings {
3737
},
3838
requestTimeoutMs: 1500,
3939
cacheTimeToLiveSeconds: 60
40+
};
41+
42+
this.configcatClient = configcat.createClientWithLazyLoad(key, {
43+
baseUrl: new URL('/configcat', this.hostService.gitpodHost).href,
44+
...configCatOptions
4045
});
46+
47+
hostService.onDidChangeHost(() => {
48+
this.configcatClient = configcat.createClientWithLazyLoad(key, {
49+
baseUrl: new URL('/configcat', this.hostService.gitpodHost).href,
50+
...configCatOptions
51+
});
52+
});
53+
4154
this.extensionVersion = new semver.SemVer(extensionVersion);
4255
}
4356

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export async function activate(context: vscode.ExtensionContext) {
7878
const sessionService = new SessionService(hostService, logger);
7979
context.subscriptions.push(sessionService);
8080

81-
const experiments = new ExperimentalSettings('gitpod', packageJSON.version, sessionService, context, logger);
81+
const experiments = new ExperimentalSettings('gitpod', packageJSON.version, sessionService, hostService,logger);
8282
context.subscriptions.push(experiments);
8383

8484
const settingsSync = new SettingsSync(commandManager, logger, telemetryService, notificationService);

0 commit comments

Comments
 (0)