Browse Source

feat(edgex): add messageType to conf util

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang 3 years atrás
parent
commit
3bdbd56fbe
2 changed files with 6 additions and 3 deletions
  1. 1 0
      deploy/docker/conf_util.go
  2. 5 3
      deploy/docker/conf_util_test.go

+ 1 - 0
deploy/docker/conf_util.go

@@ -49,6 +49,7 @@ var file_keys_map = map[string]map[string]string{
 		"CERTPEMBLOCK":      "CertPEMBlock",
 		"KEYPEMBLOCK":       "KeyPEMBlock",
 		"SKIPCERTVERIFY":    "SkipCertVerify",
+		"MESSAGETYPE":       "messageType",
 	},
 	"mqtt_source": {
 		"SHAREDSUBSCRIPTION": "sharedSubscription",

+ 5 - 3
deploy/docker/conf_util_test.go

@@ -191,6 +191,7 @@ func TestProcessEnv(t *testing.T) {
 		{
 			vars: []string{
 				"EDGEX__DEFAULT__TYPE=zmq",
+				"EDGEX__DEFAULT__MESSAGETYPE=event",
 				"EDGEX__DEFAULT__OPTIONAL__CLIENTID=clientid_0000",
 				"EDGEX__DEFAULT__OPTIONAL__PASSWORD=should_not_print",
 				"EDGEX__APPLICATION_CONF__PROTOCOL=ssl",
@@ -198,8 +199,9 @@ func TestProcessEnv(t *testing.T) {
 			file: "edgex",
 			expt: map[string]interface{}{
 				"default": map[string]interface{}{
-					"protocol": "tcp",
-					"type":     "zmq",
+					"messageType": "event",
+					"protocol":    "tcp",
+					"type":        "zmq",
 					"optional": map[string]interface{}{
 						"ClientId": "clientid_0000",
 						"Password": "should_not_print",
@@ -209,7 +211,7 @@ func TestProcessEnv(t *testing.T) {
 					"protocol": "ssl",
 				},
 			},
-			out: "application_conf:\n    protocol: ssl\ndefault:\n    optional:\n        ClientId: clientid_0000\n        Password: '*'\n    protocol: tcp\n    type: zmq\n",
+			out: "application_conf:\n    protocol: ssl\ndefault:\n    messageType: event\n    optional:\n        ClientId: clientid_0000\n        Password: '*'\n    protocol: tcp\n    type: zmq\n",
 		},
 	}
 	files := make(map[string]map[string]interface{})