mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
Uniformly use proxy to get the configuration of configcat (#16942)
* Uniformly use proxy to get the configuration of configcat * Add configcat enabled in workspace info api * enabled configcat in ide-service
This commit is contained in:
parent
555ee279fe
commit
b465d06617
@ -32,32 +32,43 @@ type Attributes struct {
|
||||
VSCodeClientID string
|
||||
}
|
||||
|
||||
type ClientOpt func(o *options)
|
||||
|
||||
func WithGitpodProxy(gitpodHost string) ClientOpt {
|
||||
return func(o *options) {
|
||||
o.sdkKey = "gitpod"
|
||||
o.baseURL = fmt.Sprintf("https://%s/configcat", gitpodHost)
|
||||
o.pollInterval = 1 * time.Minute
|
||||
}
|
||||
}
|
||||
|
||||
type options struct {
|
||||
pollInterval time.Duration
|
||||
baseURL string
|
||||
sdkKey string
|
||||
}
|
||||
|
||||
// NewClient constructs a new experiments.Client. This is NOT A SINGLETON.
|
||||
// You should normally only call this once in the lifecycle of an application, clients are independent of each other will refresh flags on their own.
|
||||
// If the environment contains CONFIGCAT_SDK_KEY value, it vill be used to construct a ConfigCat client.
|
||||
// If the environment contains CONFIGCAT_SDK_KEY value, it will be used to construct a ConfigCat client.
|
||||
// Otherwise, it returns a client which always returns the default value. This client is used for Self-Hosted installations.
|
||||
func NewClient() Client {
|
||||
// TODO: get rid fo GITPOD_HOST is implementaion detail of supervisor, it is a subject to change
|
||||
// gitpodHost should be provided as an option instead
|
||||
gitpodHost := os.Getenv("GITPOD_HOST")
|
||||
if gitpodHost == "" {
|
||||
gitpodHost = os.Getenv("HOST_URL")
|
||||
func NewClient(opts ...ClientOpt) Client {
|
||||
opt := &options{
|
||||
sdkKey: os.Getenv("CONFIGCAT_SDK_KEY"),
|
||||
baseURL: os.Getenv("CONFIGCAT_BASE_URL"),
|
||||
pollInterval: 3 * time.Minute,
|
||||
}
|
||||
if gitpodHost != "" {
|
||||
return newConfigCatClient(configcat.Config{
|
||||
SDKKey: "gitpod",
|
||||
BaseURL: fmt.Sprintf("%s%s", gitpodHost, "/configcat"),
|
||||
PollInterval: 1 * time.Minute,
|
||||
HTTPTimeout: 3 * time.Second,
|
||||
})
|
||||
for _, o := range opts {
|
||||
o(opt)
|
||||
}
|
||||
sdkKey := os.Getenv("CONFIGCAT_SDK_KEY")
|
||||
if sdkKey == "" {
|
||||
|
||||
if opt.sdkKey == "" {
|
||||
return NewAlwaysReturningDefaultValueClient()
|
||||
}
|
||||
return newConfigCatClient(configcat.Config{
|
||||
SDKKey: sdkKey,
|
||||
PollInterval: 3 * time.Minute,
|
||||
SDKKey: opt.sdkKey,
|
||||
BaseURL: opt.baseURL,
|
||||
PollInterval: opt.pollInterval,
|
||||
HTTPTimeout: 3 * time.Second,
|
||||
Logger: &configCatLogger{log.Log},
|
||||
})
|
||||
|
||||
@ -35,6 +35,7 @@ export function getExperimentsClientForBackend(): Client {
|
||||
requestTimeoutMs: 2000,
|
||||
logger: configcat.createConsoleLogger(LogLevel.Error),
|
||||
maxInitWaitTimeSeconds: 0,
|
||||
baseUrl: process.env.CONFIGCAT_BASE_URL,
|
||||
});
|
||||
|
||||
client = new ConfigCatClient(configCatClient);
|
||||
|
||||
@ -254,6 +254,13 @@ func (s *IDEServiceServer) ResolveWorkspaceConfig(ctx context.Context, req *api.
|
||||
IdeImageLayers: defaultIde.ImageLayers,
|
||||
}
|
||||
|
||||
if os.Getenv("CONFIGCAT_SDK_KEY") != "" {
|
||||
resp.Envvars = append(resp.Envvars, &api.EnvironmentVariable{
|
||||
Name: "GITPOD_CONFIGCAT_ENABLED",
|
||||
Value: "true",
|
||||
})
|
||||
}
|
||||
|
||||
var wsConfig *gitpodapi.GitpodConfig
|
||||
|
||||
if req.WorkspaceConfig != "" {
|
||||
|
||||
@ -154,6 +154,8 @@ type WorkspaceInfoResponse struct {
|
||||
OwnerId string `protobuf:"bytes,16,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
|
||||
// debug_workspace_type indicates whether it is a regular or prebuild debug workspace
|
||||
DebugWorkspaceType DebugWorkspaceType `protobuf:"varint,17,opt,name=debug_workspace_type,json=debugWorkspaceType,proto3,enum=supervisor.DebugWorkspaceType" json:"debug_workspace_type,omitempty"`
|
||||
// configcat_enabled controls whether configcat is enabled
|
||||
ConfigcatEnabled bool `protobuf:"varint,18,opt,name=configcat_enabled,json=configcatEnabled,proto3" json:"configcat_enabled,omitempty"`
|
||||
}
|
||||
|
||||
func (x *WorkspaceInfoResponse) Reset() {
|
||||
@ -314,6 +316,13 @@ func (x *WorkspaceInfoResponse) GetDebugWorkspaceType() DebugWorkspaceType {
|
||||
return DebugWorkspaceType_noDebug
|
||||
}
|
||||
|
||||
func (x *WorkspaceInfoResponse) GetConfigcatEnabled() bool {
|
||||
if x != nil {
|
||||
return x.ConfigcatEnabled
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type isWorkspaceInfoResponse_WorkspaceLocation interface {
|
||||
isWorkspaceInfoResponse_WorkspaceLocation()
|
||||
}
|
||||
@ -519,8 +528,8 @@ var file_info_proto_rawDesc = []byte{
|
||||
0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x16, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70,
|
||||
0x61, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xd9,
|
||||
0x08, 0x0a, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x61, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x86,
|
||||
0x09, 0x0a, 0x15, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x6f, 0x72, 0x6b,
|
||||
0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x69,
|
||||
@ -574,39 +583,42 @@ var file_info_proto_rawDesc = []byte{
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f,
|
||||
0x72, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65,
|
||||
0x54, 0x79, 0x70, 0x65, 0x52, 0x12, 0x64, 0x65, 0x62, 0x75, 0x67, 0x57, 0x6f, 0x72, 0x6b, 0x73,
|
||||
0x70, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x1a, 0x3b, 0x0a, 0x09, 0x47, 0x69, 0x74, 0x70,
|
||||
0x6f, 0x64, 0x41, 0x50, 0x49, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x68, 0x6f, 0x73, 0x74, 0x1a, 0x36, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74,
|
||||
0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0x65, 0x0a,
|
||||
0x0e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12,
|
||||
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
|
||||
0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61,
|
||||
0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x42, 0x14, 0x0a, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
|
||||
0x65, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x3c, 0x0a, 0x12, 0x44, 0x65,
|
||||
0x62, 0x75, 0x67, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
|
||||
0x12, 0x0b, 0x0a, 0x07, 0x6e, 0x6f, 0x44, 0x65, 0x62, 0x75, 0x67, 0x10, 0x00, 0x12, 0x0b, 0x0a,
|
||||
0x07, 0x72, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x70, 0x72,
|
||||
0x65, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x10, 0x02, 0x32, 0x7f, 0x0a, 0x0b, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x70, 0x0a, 0x0d, 0x57, 0x6f, 0x72, 0x6b, 0x73,
|
||||
0x70, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72,
|
||||
0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x73, 0x75, 0x70,
|
||||
0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
|
||||
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82,
|
||||
0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x2f,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x46, 0x0a, 0x18, 0x69, 0x6f, 0x2e,
|
||||
0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f,
|
||||
0x72, 0x2e, 0x61, 0x70, 0x69, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2d, 0x69, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x70,
|
||||
0x6f, 0x64, 0x2f, 0x73, 0x75, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2f, 0x61, 0x70,
|
||||
0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x70, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x63, 0x61, 0x74, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x12, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x63, 0x61, 0x74, 0x45, 0x6e,
|
||||
0x61, 0x62, 0x6c, 0x65, 0x64, 0x1a, 0x3b, 0x0a, 0x09, 0x47, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x41,
|
||||
0x50, 0x49, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f,
|
||||
0x73, 0x74, 0x1a, 0x36, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0x65, 0x0a, 0x0e, 0x57, 0x6f,
|
||||
0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c,
|
||||
0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x42, 0x14, 0x0a, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6c,
|
||||
0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x3c, 0x0a, 0x12, 0x44, 0x65, 0x62, 0x75, 0x67,
|
||||
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a,
|
||||
0x07, 0x6e, 0x6f, 0x44, 0x65, 0x62, 0x75, 0x67, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x72, 0x65,
|
||||
0x67, 0x75, 0x6c, 0x61, 0x72, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x62, 0x75,
|
||||
0x69, 0x6c, 0x64, 0x10, 0x02, 0x32, 0x7f, 0x0a, 0x0b, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x12, 0x70, 0x0a, 0x0d, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
|
||||
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73,
|
||||
0x6f, 0x72, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x76,
|
||||
0x69, 0x73, 0x6f, 0x72, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93,
|
||||
0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x77, 0x6f, 0x72,
|
||||
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x42, 0x46, 0x0a, 0x18, 0x69, 0x6f, 0x2e, 0x67, 0x69, 0x74,
|
||||
0x70, 0x6f, 0x64, 0x2e, 0x73, 0x75, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x61,
|
||||
0x70, 0x69, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67,
|
||||
0x69, 0x74, 0x70, 0x6f, 0x64, 0x2d, 0x69, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x70, 0x6f, 0x64, 0x2f,
|
||||
0x73, 0x75, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@ -97,6 +97,9 @@ message WorkspaceInfoResponse {
|
||||
|
||||
// debug_workspace_type indicates whether it is a regular or prebuild debug workspace
|
||||
DebugWorkspaceType debug_workspace_type = 17;
|
||||
|
||||
// configcat_enabled controls whether configcat is enabled
|
||||
bool configcat_enabled = 18;
|
||||
}
|
||||
|
||||
enum DebugWorkspaceType {
|
||||
|
||||
@ -52,6 +52,7 @@ type ServiceConfig struct {
|
||||
WorkspaceID string
|
||||
OwnerID string
|
||||
SupervisorVersion string
|
||||
ConfigcatEnabled bool
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
@ -109,11 +110,15 @@ func NewServerApiService(ctx context.Context, cfg *ServiceConfig, tknsrv api.Tok
|
||||
return nil
|
||||
}
|
||||
|
||||
opts := []experiments.ClientOpt{}
|
||||
if cfg.ConfigcatEnabled {
|
||||
opts = append(opts, experiments.WithGitpodProxy(cfg.Host))
|
||||
}
|
||||
service := &Service{
|
||||
token: tknres.Token,
|
||||
gitpodService: gitpodService,
|
||||
cfg: cfg,
|
||||
experiments: experiments.NewClient(),
|
||||
experiments: experiments.NewClient(opts...),
|
||||
apiMetrics: NewClientMetrics(),
|
||||
onUsingPublicAPI: make(chan struct{}),
|
||||
subs: make(map[chan *gitpod.WorkspaceInstance]struct{}),
|
||||
|
||||
@ -298,6 +298,9 @@ type WorkspaceConfig struct {
|
||||
|
||||
// DebugWorkspaceContenSource indicates where the debug workspace content came from
|
||||
DebugWorkspaceContenSource api.ContentSource `env:"SUPERVISOR_DEBUG_WORKSPACE_CONTENT_SOURCE"`
|
||||
|
||||
// ConfigcatEnabled controls whether configcat is enabled
|
||||
ConfigcatEnabled bool `env:"GITPOD_CONFIGCAT_ENABLED"`
|
||||
}
|
||||
|
||||
// WorkspaceGitpodToken is a list of tokens that should be added to supervisor's token service.
|
||||
|
||||
@ -670,6 +670,7 @@ func (is *InfoService) WorkspaceInfo(context.Context, *api.WorkspaceInfoRequest)
|
||||
WorkspaceClass: &api.WorkspaceInfoResponse_WorkspaceClass{Id: is.cfg.WorkspaceClass},
|
||||
OwnerId: is.cfg.OwnerId,
|
||||
DebugWorkspaceType: is.cfg.DebugWorkspaceType,
|
||||
ConfigcatEnabled: is.cfg.ConfigcatEnabled,
|
||||
}
|
||||
if is.cfg.WorkspaceClassInfo != nil {
|
||||
resp.WorkspaceClass.DisplayName = is.cfg.WorkspaceClassInfo.DisplayName
|
||||
|
||||
@ -262,6 +262,7 @@ func Run(options ...RunOption) {
|
||||
WorkspaceID: cfg.WorkspaceID,
|
||||
OwnerID: cfg.OwnerId,
|
||||
SupervisorVersion: Version,
|
||||
ConfigcatEnabled: cfg.ConfigcatEnabled,
|
||||
}, tokenService)
|
||||
}
|
||||
|
||||
|
||||
@ -424,7 +424,11 @@ func ConfigcatEnv(ctx *RenderContext) []corev1.EnvVar {
|
||||
return []corev1.EnvVar{
|
||||
{
|
||||
Name: "CONFIGCAT_SDK_KEY",
|
||||
Value: sdkKey,
|
||||
Value: "gitpod",
|
||||
},
|
||||
{
|
||||
Name: "CONFIGCAT_BASE_URL",
|
||||
Value: "https://" + ctx.Config.Domain + "/configcat",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,6 +79,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
|
||||
},
|
||||
Env: common.CustomizeEnvvar(ctx, Component, common.MergeEnv(
|
||||
common.DefaultEnv(&ctx.Config),
|
||||
common.ConfigcatEnv(ctx),
|
||||
)),
|
||||
VolumeMounts: []corev1.VolumeMount{
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user