Quellcode durchsuchen

Taos (#540)

* feat():Set default values for taos sink plugin #527

* Set default values for taos sink plugin #527

Co-authored-by: EMqmyd <mayuedong@emx.io>
EMQmyd vor 4 Jahren
Ursprung
Commit
919d7d3dc3
2 geänderte Dateien mit 8 neuen und 5 gelöschten Zeilen
  1. 2 2
      etc/sinks/taos.json
  2. 6 3
      plugins/sinks/taos.go

+ 2 - 2
etc/sinks/taos.json

@@ -77,7 +77,7 @@
 		}
 		}
 	}, {
 	}, {
 		"name": "database",
 		"name": "database",
-		"default": "db",
+		"default": "",
 		"optional": false,
 		"optional": false,
 		"control": "text",
 		"control": "text",
 		"type": "string",
 		"type": "string",
@@ -91,7 +91,7 @@
 		}
 		}
 	}, {
 	}, {
 		"name": "table",
 		"name": "table",
-		"default": "t",
+		"default": "",
 		"optional": false,
 		"optional": false,
 		"control": "text",
 		"control": "text",
 		"type": "string",
 		"type": "string",

+ 6 - 3
plugins/sinks/taos.go

@@ -75,13 +75,16 @@ func (m *taosSink) Configure(props map[string]interface{}) error {
 		return fmt.Errorf("read properties %v fail with error: %v", props, err)
 		return fmt.Errorf("read properties %v fail with error: %v", props, err)
 	}
 	}
 	if cfg.Ip == "" {
 	if cfg.Ip == "" {
-		return fmt.Errorf("property ip is required")
+		cfg.Ip = "127.0.0.1"
+		common.Log.Infof("Not find IP conf, will use default value '127.0.0.1'.")
 	}
 	}
 	if cfg.User == "" {
 	if cfg.User == "" {
-		return fmt.Errorf("property user is required")
+		cfg.User = "root"
+		common.Log.Infof("Not find user conf, will use default value 'root'.")
 	}
 	}
 	if cfg.Password == "" {
 	if cfg.Password == "" {
-		return fmt.Errorf("property password is required")
+		cfg.Password = "taosdata"
+		common.Log.Infof("Not find password conf, will use default value 'taosdata'.")
 	}
 	}
 	if cfg.Database == "" {
 	if cfg.Database == "" {
 		return fmt.Errorf("property database is required")
 		return fmt.Errorf("property database is required")