Skip to content

Commit

Permalink
[installer] add configcat env for proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
mustard-mh committed Sep 8, 2022
1 parent 0a115cc commit 1eeb694
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
7 changes: 3 additions & 4 deletions .werft/jobs/build/installer/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,9 @@ EOF`);

private configureConfigCat(slice: string) {
// This key is not a secret, it is a unique identifier of our ConfigCat application
exec(
`yq w -i ${this.options.installerConfigPath} experimental.webapp.configcatKey "WBLaCPtkjkqKHlHedziE9g/LEAOCNkbuUKiqUZAcVg7dw"`,
{ slice: slice },
);
exec(`yq w -i ${this.options.installerConfigPath} experimental.webapp.configcatKey "WBLaCPtkjkqKHlHedziE9g/LEAOCNkbuUKiqUZAcVg7dw"`, { slice: slice });
exec(`yq w -i ${this.options.installerConfigPath} experimental.webapp.configcatBaseUrl "https://cdn-global.configcat.com"`,{ slice: slice });
exec(`yq w -i ${this.options.installerConfigPath} experimental.webapp.configcatPollInterval "10m"`,{ slice: slice });
}

private includeAnalytics(slice: string): void {
Expand Down
32 changes: 25 additions & 7 deletions install/installer/pkg/components/proxy/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,30 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
return nil
})

env := common.CustomizeEnvvar(ctx, Component, common.MergeEnv(
common.DefaultEnv(&ctx.Config),
[]corev1.EnvVar{{
Name: "PROXY_DOMAIN",
Value: ctx.Config.Domain,
}},
))

_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
if cfg.WebApp != nil {
env = append(env, corev1.EnvVar{
Name: "CONFIGCAT_SDK_KEY",
Value: cfg.WebApp.ConfigcatKey,
}, corev1.EnvVar{
Name: "CONFIGCAT_BASE_URL",
Value: cfg.WebApp.ConfigcatBaseUrl,
}, corev1.EnvVar{
Name: "CONFIGCAT_POLL_INTERVAL",
Value: cfg.WebApp.ConfigcatPollInterval,
})
}
return nil
})

const kubeRbacProxyContainerName = "kube-rbac-proxy"
return []runtime.Object{
&appsv1.Deployment{
Expand Down Expand Up @@ -244,13 +268,7 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
FailureThreshold: 3,
},
VolumeMounts: volumeMounts,
Env: common.CustomizeEnvvar(ctx, Component, common.MergeEnv(
common.DefaultEnv(&ctx.Config),
[]corev1.EnvVar{{
Name: "PROXY_DOMAIN",
Value: ctx.Config.Domain,
}},
)),
Env: env,
}},
},
},
Expand Down
3 changes: 3 additions & 0 deletions install/installer/pkg/config/v1/experimental/experimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ type WebAppConfig struct {
DisableMigration bool `json:"disableMigration"`
Usage *UsageConfig `json:"usage,omitempty"`
ConfigcatKey string `json:"configcatKey"`
ConfigcatBaseUrl string `json:"configcatBaseUrl"`
ConfigcatPollInterval string `json:"configcatPollInterval"`
ConfigcatDefaultConfig string `json:"configcatDefaultConfig"`
WorkspaceClasses []WebAppWorkspaceClass `json:"workspaceClasses"`
}

Expand Down

0 comments on commit 1eeb694

Please sign in to comment.