diff --git a/go.mod b/go.mod index ebfc2353..95ac6afa 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.23.12 require ( github.com/aws/aws-sdk-go v1.44.100 - github.com/codeready-toolchain/api v0.0.0-20251008084914-06282b83d4cd + github.com/codeready-toolchain/api v0.0.0-20251111133521-6e510c9bd2ee github.com/codeready-toolchain/toolchain-common v0.0.0-20251006132314-2591ebe0bdb1 github.com/go-logr/logr v1.4.2 github.com/gofrs/uuid v4.2.0+incompatible diff --git a/go.sum b/go.sum index 5b1e4791..49a71268 100644 --- a/go.sum +++ b/go.sum @@ -48,8 +48,8 @@ github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtM github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/codeready-toolchain/api v0.0.0-20251008084914-06282b83d4cd h1:A6WOUwlUdgOf4PDzzgKvycRj4Pk+1F6npWV4YoPVFcM= -github.com/codeready-toolchain/api v0.0.0-20251008084914-06282b83d4cd/go.mod h1:TiQ/yNv3cGL4nxo3fgRtcHyYYuRf+nAgs6B1IAqvxOU= +github.com/codeready-toolchain/api v0.0.0-20251111133521-6e510c9bd2ee h1:xuUh5aTG6NEG+HDs9e6QomAmHd/5gff7KtLJbbAR9y8= +github.com/codeready-toolchain/api v0.0.0-20251111133521-6e510c9bd2ee/go.mod h1:TiQ/yNv3cGL4nxo3fgRtcHyYYuRf+nAgs6B1IAqvxOU= github.com/codeready-toolchain/toolchain-common v0.0.0-20251006132314-2591ebe0bdb1 h1:jqs4yOuJbfW3CKe1EMJkkDo47wTKQ4M1OKox4DYWsKg= github.com/codeready-toolchain/toolchain-common v0.0.0-20251006132314-2591ebe0bdb1/go.mod h1:eySMK8JR/Py9eoUJlAkOXqvfPp1vjl39scgrECr99XM= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/pkg/configuration/configuration.go b/pkg/configuration/configuration.go index 704befca..3c33d090 100644 --- a/pkg/configuration/configuration.go +++ b/pkg/configuration/configuration.go @@ -147,6 +147,10 @@ func (r RegistrationServiceConfig) UICanaryDeploymentWeight() int { return commonconfig.GetInt(r.cfg.Host.RegistrationService.UICanaryDeploymentWeight, 20) } +func (r RegistrationServiceConfig) WorkatoWebHookURL() string { + return commonconfig.GetString(r.cfg.Host.RegistrationService.WorkatoWebHookURL, "") +} + type AnalyticsConfig struct { c toolchainv1alpha1.RegistrationServiceAnalyticsConfig } diff --git a/pkg/controller/uiconfig.go b/pkg/controller/uiconfig.go index 14d420ce..a32bfafd 100644 --- a/pkg/controller/uiconfig.go +++ b/pkg/controller/uiconfig.go @@ -11,6 +11,8 @@ type UIConfigResponse struct { // Holds to weight specifying up to how many users ( in percentage ) should use the new UI. // NOTE: this is a temporary parameter, it will be removed once we switch all the users to the new UI. UICanaryDeploymentWeight int `json:"uiCanaryDeploymentWeight"` + + WorkatoWebHookURL string `json:"workatoWebHookURL"` } // UIConfig implements the ui config endpoint, which is invoked to @@ -28,6 +30,7 @@ func (uic *UIConfig) GetHandler(ctx *gin.Context) { cfg := configuration.GetRegistrationServiceConfig() configRespData := UIConfigResponse{ UICanaryDeploymentWeight: cfg.UICanaryDeploymentWeight(), + WorkatoWebHookURL: cfg.WorkatoWebHookURL(), } ctx.JSON(http.StatusOK, configRespData) } diff --git a/pkg/controller/uiconfig_test.go b/pkg/controller/uiconfig_test.go index a6f7c720..c5c8abe8 100644 --- a/pkg/controller/uiconfig_test.go +++ b/pkg/controller/uiconfig_test.go @@ -34,7 +34,8 @@ func (s *TestUIConfigSuite) TestUIConfigHandler() { // Check if the config is set to testing mode, so the handler may use this. assert.True(s.T(), configuration.IsTestingMode(), "testing mode not set correctly to true") s.OverrideApplicationDefault(testconfig.RegistrationService(). - RegistrationServiceURL("https://signup.domain.com")) + RegistrationServiceURL("https://signup.domain.com"), + ) defer s.DefaultConfig() cfg := configuration.GetRegistrationServiceConfig() @@ -63,5 +64,9 @@ func (s *TestUIConfigSuite) TestUIConfigHandler() { s.Run("uiCanaryDeploymentWeight", func() { assert.Equal(s.T(), cfg.UICanaryDeploymentWeight(), data.UICanaryDeploymentWeight, "wrong 'UICanaryDeploymentWeight' in uiconfig response") }) + + s.Run("workatoWebHookURL", func() { + assert.Equal(s.T(), cfg.WorkatoWebHookURL(), data.WorkatoWebHookURL, "wrong 'WorkatoWebHookURL' in uiconfig response") + }) }) }