Skip to content

Commit 1904f7b

Browse files
committed
Re-initialize the cc client on host change
1 parent 491efa7 commit 1904f7b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/experiments.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ export class ExperimentalSettings {
2727
private readonly hostService: IHostService,
2828
private readonly logger: ILogService
2929
) {
30-
const host = hostService.gitpodHost;
31-
32-
this.configcatClient = configcat.createClientWithLazyLoad(key, {
33-
baseUrl: new URL('/configcat', host).href,
30+
const configCatOptions = {
3431
logger: {
3532
debug(): void { },
3633
log(): void { },
@@ -40,7 +37,20 @@ export class ExperimentalSettings {
4037
},
4138
requestTimeoutMs: 1500,
4239
cacheTimeToLiveSeconds: 60
40+
};
41+
42+
this.configcatClient = configcat.createClientWithLazyLoad(key, {
43+
baseUrl: new URL('/configcat', hostService.gitpodHost).href,
44+
...configCatOptions
4345
});
46+
47+
hostService.onDidChangeHost(() => {
48+
this.configcatClient = configcat.createClientWithLazyLoad(key, {
49+
baseUrl: new URL('/configcat', hostService.gitpodHost).href,
50+
...configCatOptions
51+
});
52+
});
53+
4454
this.extensionVersion = new semver.SemVer(extensionVersion);
4555
}
4656

0 commit comments

Comments
 (0)