@@ -33,7 +33,16 @@ export class ExperimentalSettings {
33
33
this . extensionVersion = new semver . SemVer ( extensionVersion ) ;
34
34
}
35
35
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 > {
37
46
const config = vscode . workspace . getConfiguration ( 'gitpod' ) ;
38
47
const values = config . inspect < T > ( key . substring ( 'gitpod.' . length ) ) ;
39
48
if ( ! values || ! EXPERTIMENTAL_SETTINGS . includes ( key ) ) {
@@ -50,13 +59,21 @@ export class ExperimentalSettings {
50
59
}
51
60
52
61
const user = userId ? new configcatcommon . User ( userId , undefined , undefined , custom ) : undefined ;
53
- const configcatKey = key . replace ( / \. / g, '_' ) ; // '.' are not allowed in configcat
54
62
const experimentValue = ( await this . configcatClient . getValueAsync ( configcatKey , undefined , user ) ) as T | undefined ;
55
63
56
64
return experimentValue ?? values . defaultValue ;
57
65
}
58
66
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 > {
60
77
const config = vscode . workspace . getConfiguration ( 'gitpod' ) ;
61
78
const values = config . inspect < T > ( key . substring ( 'gitpod.' . length ) ) ;
62
79
if ( ! values || ! EXPERTIMENTAL_SETTINGS . includes ( key ) ) {
@@ -65,7 +82,6 @@ export class ExperimentalSettings {
65
82
}
66
83
67
84
const user = userId ? new configcatcommon . User ( userId , undefined , undefined , custom ) : undefined ;
68
- const configcatKey = key . replace ( / \. / g, '_' ) ; // '.' are not allowed in configcat
69
85
const experimentValue = ( await this . configcatClient . getValueAsync ( configcatKey , undefined , user ) ) as T | undefined ;
70
86
71
87
return { key, defaultValue : values . defaultValue , globalValue : values . globalValue , experimentValue } ;
0 commit comments