mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-01 03:07:51 +08:00
Merge pull request #303 from GLYASAI/RAINBOND-998
[FIX] err creating third-party service
This commit is contained in:
commit
8093677ff7
@ -600,7 +600,6 @@ func (t *TenantStruct) CreateService(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
tenantID := r.Context().Value(middleware.ContextKey("tenant_id")).(string)
|
||||
ss.TenantID = tenantID
|
||||
logrus.Debugf("begin to create service %s", ss.ServiceAlias)
|
||||
if err := handler.GetServiceManager().ServiceCreate(&ss); err != nil {
|
||||
httputil.ReturnError(r, w, 500, fmt.Sprintf("create service error, %v", err))
|
||||
return
|
||||
|
@ -631,6 +631,9 @@ func (s *ServiceAction) ServiceCreate(sc *api_model.ServiceStruct) error {
|
||||
// sc.Endpoints can't be nil
|
||||
// sc.Endpoints.Discovery or sc.Endpoints.Static can't be nil
|
||||
if sc.Kind == dbmodel.ServiceKindThirdParty.String() { // TODO: validate request data
|
||||
if sc.Endpoints == nil {
|
||||
return fmt.Errorf("endpoints can not be empty for third-party service")
|
||||
}
|
||||
if config := strings.Replace(sc.Endpoints.Discovery, " ", "", -1); config != "" {
|
||||
var cfg dCfg
|
||||
err := json.Unmarshal([]byte(config), &cfg)
|
||||
|
Loading…
Reference in New Issue
Block a user