AlexStocks commented on a change in pull request #158:
URL: https://github.com/apache/dubbo-go-pixiu/pull/158#discussion_r619830775
##########
File path: pkg/config/config_load.go
##########
@@ -168,22 +183,22 @@ func YAMLConfigLoad(path string) *model.Bootstrap {
}
c.Lb = model.LbPolicy(lbPolicy)
}
-
- return cfg
}
-// DefaultConfigLoad if not config, will load this
-func DefaultConfigLoad(path string) *model.Bootstrap {
- log.Println("load config from : ", path)
- content, err := ioutil.ReadFile(path)
- if err != nil {
- log.Fatalln("[config] [default load] load config failed, ", err)
- }
- cfg := &model.Bootstrap{}
- // translate to lower case
- err = json.Unmarshal(content, cfg)
- if err != nil {
- log.Fatalln("[config] [default load] json unmarshal config
failed, ", err)
+func DiscoverType(cfg *model.Bootstrap) {
+ var discoverType int32
+ for _, c := range cfg.StaticResources.Clusters {
+ if c.TypeStr != "" {
+ if t, ok := model.DiscoveryTypeValue[c.TypeStr]; ok {
+ discoverType = t
+ } else {
+ c.TypeStr = "EDS"
+ discoverType =
model.DiscoveryTypeValue[c.TypeStr]
+ }
+ } else {
+ c.TypeStr = "EDS"
+ discoverType = model.DiscoveryTypeValue[c.TypeStr]
+ }
Review comment:
```go
flag := false
if c.TypeStr != "" {
if t, ok := model.DiscoveryTypeValue[c.TypeStr]; ok {
discoverType = t
flag = true
}
}
if flag {
c.TypeStr = "EDS"
discoverType = model.DiscoveryTypeValue[c.TypeStr]
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]