gitee.com/h79/goutils@v1.22.10/discovery/config/endpoints.go (about) 1 package config 2 3 import ( 4 "gitee.com/h79/goutils/common/config" 5 "gitee.com/h79/goutils/common/json" 6 "gitee.com/h79/goutils/common/server" 7 ) 8 9 type EndPoints struct { 10 Servers server.Addresses `json:"servers"` 11 //consul,etcd,dubbo, local注册 12 Type string `json:"type"` 13 } 14 15 // ReadEndPoints 16 // filename 相对文件名 17 func ReadEndPoints(filename string) (EndPoints, error) { 18 if len(filename) <= 0 { 19 filename = "endpoints.json" 20 } 21 filename = config.FileNameInEnvPath(filename) 22 ep := EndPoints{} 23 err := json.Read(filename, &ep) 24 return ep, err 25 }