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 ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"io" "io"
"io/fs" "io/fs"
"net/http" "net/http"
@ -41,10 +42,16 @@ func (h *houstonHandler) GetDeploySources(w http.ResponseWriter, r *http.Request
getVersions := func(name string) []string { getVersions := func(name string) []string {
var out []string var out []string
files, _ := os.ReadDir(path.Join(h.deployPath, name)) vers, _ := os.ReadDir(path.Join(h.deployPath, name))
for _, fd := range files { for _, fd := range vers {
if fd.IsDir() { 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 return out