forked from codeready-toolchain/registration-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuiconfig.go
More file actions
36 lines (29 loc) · 1.06 KB
/
uiconfig.go
File metadata and controls
36 lines (29 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package controller
import (
"net/http"
"github.com/codeready-toolchain/registration-service/pkg/configuration"
"github.com/gin-gonic/gin"
)
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
// retrieve the config for the ui.
type UIConfig struct {
}
// NewAuthConfig returns a new AuthConfig instance.
func NewUIConfig() *UIConfig {
return &UIConfig{}
}
// GetHandler returns raw auth config content for UI.
func (uic *UIConfig) GetHandler(ctx *gin.Context) {
cfg := configuration.GetRegistrationServiceConfig()
configRespData := UIConfigResponse{
UICanaryDeploymentWeight: cfg.UICanaryDeploymentWeight(),
WorkatoWebHookURL: cfg.WorkatoWebHookURL(),
}
ctx.JSON(http.StatusOK, configRespData)
}