insertdata/insertDataToEs.go
@@ -1,13 +1,13 @@ package insertdata import ( "ruleprocess/logger" "encoding/json" "errors" "fmt" "io/ioutil" "net" "ruleprocess/cache" "ruleprocess/logger" "strings" "time" @@ -20,10 +20,14 @@ ) var weedfsUrl string type conf struct { PhotoUrl string PhotoUrl string `yaml:"photoUrl"` } func init() { data, _ := ioutil.ReadFile("conf.yml") data, err := ioutil.ReadFile("./config/conf.yml") if err != nil { fmt.Println("读取配置文件出错--",err) logger.Error("读取配置文件出错--",err) } c := conf{} //把yaml形式的字符串解析成struct类型 yaml.Unmarshal(data, &c)