클라이언트에서는 태그를 없애고 서버에서만 관리

This commit is contained in:
2023-07-03 11:34:21 +09:00
parent 9bd09509c8
commit 4d9a25dd6b
4 changed files with 77 additions and 80 deletions

View File

@ -50,12 +50,24 @@ func (h *houstonHandler) GetDeploySources(w http.ResponseWriter, r *http.Request
ver := fd.Name()
files, _ := os.ReadDir(path.Join(h.deployPath, name, ver))
if len(files) > 0 {
downloadpath := path.Join(sub_folder_name_deploys, name, ver, files[0].Name())
ver = fmt.Sprintf("%s:%s", ver, downloadpath)
for _, file := range files {
if strings.HasPrefix(file.Name(), "@") {
continue
}
downloadpath := path.Join(sub_folder_name_deploys, name, ver, file.Name())
ver = fmt.Sprintf("%s:%s", ver, downloadpath)
break
}
}
out = append(out, ver)
vertags, _ := os.ReadFile(path.Join(h.deployPath, name, ver, "@tags"))
out = append(out, ver+string(vertags))
}
}
mytags, _ := os.ReadFile(path.Join(h.deployPath, name, "@tags"))
if len(mytags) > 0 {
out = append(out, string(mytags))
}
return out
}
@ -100,8 +112,12 @@ func (h *houstonHandler) UploadDeploySource(w http.ResponseWriter, r *http.Reque
if version == "config" {
filename = path.Join(h.deployPath, name, version, "config"+ext)
tags, _ := os.ReadFile(path.Join(h.deployPath, name, version, "@tags"))
if !strings.Contains(string(tags), "#hidden") {
tags = []byte(string(tags) + "#hidden")
os.WriteFile(path.Join(h.deployPath, name, version, "@tags"), tags, 0644)
}
} else {
// deploys 폴더는 파일시스템 서비스이므로 다운로드 가능
filename = path.Join(h.deployPath, name, version, name+ext)
}
@ -223,6 +239,10 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
continue
}
if strings.HasPrefix(fd.Name(), "@") {
continue
}
fi, _ := fd.Info()
if fi.ModTime().After(latestTime) {
latestFilename = fi.Name()