优化配置读取规则,只允许读取.json配置

This commit is contained in:
orgin
2022-10-13 14:29:49 +08:00
parent d87ad419c8
commit 17a448f75c

View File

@@ -6,6 +6,7 @@ import (
"github.com/duanhf2012/origin/rpc"
jsoniter "github.com/json-iterator/go"
"os"
"path/filepath"
"strings"
)
@@ -126,6 +127,10 @@ func (cls *Cluster) readLocalService(localNodeId int) error {
continue
}
if filepath.Ext(f.Name())!= ".json" {
continue
}
filePath := strings.TrimRight(strings.TrimRight(clusterCfgPath, "/"), "\\") + "/" + f.Name()
currGlobalCfg, serviceConfig, mapNodeService, err := cls.readServiceConfig(filePath)
if err != nil {