This commit is contained in:
yanweidong 2024-03-21 18:15:36 +08:00
parent 2b22041ed8
commit a893f6ac86
1 changed files with 24 additions and 10 deletions

View File

@ -55,26 +55,40 @@ func etcExecute(ls []LocalServices) {
for _, service := range ls { for _, service := range ls {
yamlUrl := fmt.Sprintf("%s%s/%s/%s_%s.yaml", service.Srv.OssUrl, service.Srv.EtcPath, env.MeshEnv.Workspace, service.Srv.ServiceKey, env.MeshEnv.RuntimeMode) yamlUrl := fmt.Sprintf("%s%s/%s/%s_%s.yaml", service.Srv.OssUrl, service.Srv.EtcPath, env.MeshEnv.Workspace, service.Srv.ServiceKey, env.MeshEnv.RuntimeMode)
body, err := utils.HttpGet(yamlUrl) body, err := utils.HttpGet(yamlUrl)
checkError(err) if err != nil {
fmt.Println("Check YAML Configure:", yamlUrl, " [ERROR]", err.Error())
} else {
fmt.Println("Check YAML Configure:", yamlUrl, " [OK]") fmt.Println("Check YAML Configure:", yamlUrl, " [OK]")
yamlPath := filepath.Join(env.MeshEnv.Prefix, service.Srv.EtcPath, fmt.Sprintf("%s_%s.yaml", service.Srv.ServiceKey, env.MeshEnv.RuntimeMode)) yamlPath := filepath.Join(env.MeshEnv.Prefix, service.Srv.EtcPath, fmt.Sprintf("%s_%s.yaml", service.Srv.ServiceKey, env.MeshEnv.RuntimeMode))
utils.StringToFile(yamlPath, string(body)) utils.StringToFile(yamlPath, string(body))
} }
}
} }
func getLocalServices() []LocalServices { func getLocalServices() []LocalServices {
reles := getRegistryReleases() reles := getRegistryReleases()
dirFs, err := os.ReadDir(env.MeshEnv.Prefix) dirFs, err := os.ReadDir(env.MeshEnv.Prefix)
checkError(err)
ls := make([]LocalServices, 0) ls := make([]LocalServices, 0)
for _, v := range dirFs {
version := getCurrentVersion(v.Name()) checkError(err)
for _, v := range reles.Data {
var check bool = false
for _, srv := range dirFs {
if v.ServiceKey == srv.Name() {
check = true
break
}
}
if check {
version := getCurrentVersion(v.ServiceKey)
if version != " - " { if version != " - " {
for _, srv := range reles.Data {
ls = append(ls, LocalServices{ ls = append(ls, LocalServices{
Srv: srv, Srv: v,
LocalVersion: version, LocalVersion: version,
}) })
} }