You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/10/08 06:43:03 UTC

[incubator-eventmesh] branch master updated: add eventmesh-server, eventmesh-protocol and selector config

This is an automated email from the ASF dual-hosted git repository.

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 23a5847e add eventmesh-server, eventmesh-protocol and selector config
     new 9c65044d Merge pull request #1473 from walterlife/modify-eventmesh-workflow-config
23a5847e is described below

commit 23a5847e03a9f98ae54558e75aa1db7bc9799959
Author: walterlife <wa...@gmail.com>
AuthorDate: Sat Oct 1 21:44:07 2022 +0800

    add eventmesh-server, eventmesh-protocol and selector config
---
 eventmesh-workflow-go/config/config.go      | 57 ++++++++++++++++++++++++++---
 eventmesh-workflow-go/configs/workflow.yaml | 13 +++++++
 2 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/eventmesh-workflow-go/config/config.go b/eventmesh-workflow-go/config/config.go
index a582b787..d54decf7 100644
--- a/eventmesh-workflow-go/config/config.go
+++ b/eventmesh-workflow-go/config/config.go
@@ -16,14 +16,15 @@
 package config
 
 import (
-	"github.com/apache/incubator-eventmesh/eventmesh-server-go/plugin"
+	"gopkg.in/yaml.v3"
+	"io/ioutil"
+)
+
+var (
+	cfg *Config
 )
 
 type Config struct {
-	Server struct {
-		Port uint16 `yaml:"port"`
-		Name string `yaml:"name"`
-	}
 	Flow struct {
 		Queue struct {
 			Store string `yaml:"store"`
@@ -31,6 +32,50 @@ type Config struct {
 		Schedule struct {
 			Interval int `yaml:"interval"`
 		} `yaml:"schedule"`
+		Selector string `yaml:"selector"`
+		Protocol string `yaml:"protocol"`
 	} `yaml:"flow"`
-	Plugins plugin.Config `yaml:"plugins,omitempty"`
+	Catalog struct {
+		ServerName string `yaml:"server_name"`
+	} `yaml:"catalog"`
+	EventMesh struct {
+		Host string `yaml:"host"`
+		Env  string `yaml:"env"`
+		IDC  string `yaml:"idc"`
+		GRPC struct {
+			Port int `yaml:"port"`
+		} `yaml:"grpc"`
+		Sys           string `yaml:"sys"`
+		UserName      string `yaml:"username"`
+		Password      string `yaml:"password"`
+		ProducerGroup string `yaml:"producer_group"`
+		TTL           int    `yaml:"ttl"`
+	} `yaml:"eventmesh"`
+}
+
+// Setup setup config
+func Setup(path string) error {
+	var err error
+	cfg, err = parseConfigFromFile(path)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// Get get config
+func Get() *Config {
+	return cfg
+}
+
+func parseConfigFromFile(configPath string) (*Config, error) {
+	buf, err := ioutil.ReadFile(configPath)
+	if err != nil {
+		return nil, err
+	}
+	c := &Config{}
+	if err = yaml.Unmarshal(buf, c); err != nil {
+		return nil, err
+	}
+	return c, nil
 }
diff --git a/eventmesh-workflow-go/configs/workflow.yaml b/eventmesh-workflow-go/configs/workflow.yaml
index 7679bfaf..1e6fa731 100644
--- a/eventmesh-workflow-go/configs/workflow.yaml
+++ b/eventmesh-workflow-go/configs/workflow.yaml
@@ -22,6 +22,19 @@ flow:
     store: in-memory
   schedule:
     interval: 500 # milliseconds
+  selector: nacos
+  protocol: meshmessage
+eventmesh:
+  host: "127.0.0.1"
+  env: ""
+  idc: ""
+  sys: ""
+  username: ""
+  password: ""
+  producer_group: ""
+  ttl: 10
+  grpc:
+    port: 11011
 plugins:
   registry:
     nacos:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org