diff --git a/example/receiver/workflow.yaml b/example/receiver/workflow.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b6a40961bd52b90fadd33a4f49f85ce966fb5779 --- /dev/null +++ b/example/receiver/workflow.yaml @@ -0,0 +1,7 @@ +name: Service +host: localhost +port: 9998 +sinks: + - name: db + host: localhost + port: 4242 \ No newline at end of file diff --git a/example/sender/workflow.yaml b/example/sender/workflow.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7b15845478889f885c7ef5fb57f17ab1e3bdd3d0 --- /dev/null +++ b/example/sender/workflow.yaml @@ -0,0 +1,7 @@ +name: Service +host: localhost +port: 9999 +sinks: + - name: receiver + host: localhost + port: 9998 \ No newline at end of file diff --git a/go.sum b/go.sum index 89d39973e267743fa5ffd38e693d79ea09476e92..4363ee7e146be222102d452194bd10a99bb6f845 100644 --- a/go.sum +++ b/go.sum @@ -275,6 +275,7 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= diff --git a/internal/cmd/wf/utils.go b/internal/cmd/wf/utils.go index a484d943f405f8adf187b9960b107c91830305bd..5df351bcfcb8ed4a397c5394e457452c91c5b38f 100644 --- a/internal/cmd/wf/utils.go +++ b/internal/cmd/wf/utils.go @@ -46,35 +46,10 @@ func validateConfig(wfConf *conf.WorkflowConfig) error { return errors.New("conf is nil") } - m := map[string][]conf.App{ - "Flows": wfConf.Flows, - "Sinks": wfConf.Sinks, - } - - missingApps := []string{} - missingParams := []string{} - for k, apps := range m { - if len(apps) == 0 { - missingApps = append(missingApps, k) - } else { - for _, app := range apps { - if app.Name == "" || app.Host == "" || app.Port <= 0 { - missingParams = append(missingParams, k) - } - } - } - } - errMsg := "" if wfConf.Name == "" || wfConf.Host == "" || wfConf.Port <= 0 { errMsg = "Missing name, host or port in workflow config. " } - if len(missingApps) > 0 { - errMsg += "Missing apps in " + strings.Join(missingApps, ", "+". ") - } - if len(missingApps) > 0 { - errMsg += "Missing name, host or port in " + strings.Join(missingApps, ", "+". ") - } if errMsg != "" { return errors.New(errMsg)