deploy source에 다운로드 경로를 보내줌

This commit is contained in:
2023-06-22 20:24:59 +09:00
parent c98023cc8b
commit 30ff0a4b27

View File

@ -3,6 +3,7 @@ package server
import (
"encoding/json"
"errors"
"fmt"
"io"
"io/fs"
"net/http"
@ -41,10 +42,16 @@ func (h *houstonHandler) GetDeploySources(w http.ResponseWriter, r *http.Request
getVersions := func(name string) []string {
var out []string
files, _ := os.ReadDir(path.Join(h.deployPath, name))
for _, fd := range files {
vers, _ := os.ReadDir(path.Join(h.deployPath, name))
for _, fd := range vers {
if fd.IsDir() {
out = append(out, fd.Name())
ver := fd.Name()
files, _ := os.ReadDir(path.Join(h.deployPath, name, ver))
if len(files) > 0 {
downloadpath := path.Join(h.deployPath, name, ver, files[0].Name())
ver = fmt.Sprintf("%s:%s", ver, downloadpath)
}
out = append(out, ver)
}
}
return out