deploy, download 경로 지정
This commit is contained in:
@ -26,7 +26,7 @@ func (h *houstonHandler) GetAgents(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *houstonHandler) GetDeploySources(w http.ResponseWriter, r *http.Request) {
|
||||
files, err := os.ReadDir("deploys")
|
||||
files, err := os.ReadDir(h.deployPath)
|
||||
if err != nil {
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
err = os.MkdirAll("deploys", 0775)
|
||||
@ -41,7 +41,7 @@ func (h *houstonHandler) GetDeploySources(w http.ResponseWriter, r *http.Request
|
||||
|
||||
getVersions := func(name string) []string {
|
||||
var out []string
|
||||
files, _ := os.ReadDir(path.Join("deploys", name))
|
||||
files, _ := os.ReadDir(path.Join(h.deployPath, name))
|
||||
for _, fd := range files {
|
||||
if fd.IsDir() {
|
||||
out = append(out, fd.Name())
|
||||
@ -90,10 +90,10 @@ func (h *houstonHandler) UploadDeploySource(w http.ResponseWriter, r *http.Reque
|
||||
var filename string
|
||||
|
||||
if version == "config" {
|
||||
filename = path.Join("deploys", name, version, "config.json")
|
||||
filename = path.Join(h.deployPath, name, version, "config.json")
|
||||
} else {
|
||||
// deploys 폴더는 파일시스템 서비스이므로 다운로드 가능
|
||||
filename = path.Join("deploys", name, version, name+ext)
|
||||
filename = path.Join(h.deployPath, name, version, name+ext)
|
||||
}
|
||||
|
||||
if err = os.MkdirAll(path.Dir(filename), 0775); err != nil {
|
||||
@ -125,7 +125,7 @@ func (h *houstonHandler) DeleteDeploySource(w http.ResponseWriter, r *http.Reque
|
||||
}
|
||||
|
||||
// deploys 폴더는 파일시스템 서비스이므로 다운로드 가능
|
||||
targetpath := path.Join("deploys", name, version)
|
||||
targetpath := path.Join(h.deployPath, name, version)
|
||||
if err := os.RemoveAll(targetpath); err != nil {
|
||||
logger.Println("deleteDeploySource failed :", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
@ -158,7 +158,7 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
relPath := path.Join("deploys", name, version)
|
||||
relPath := path.Join(h.deployPath, name, version)
|
||||
files, err := os.ReadDir(relPath)
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
@ -189,7 +189,7 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
|
||||
Name: name,
|
||||
Version: version,
|
||||
Url: path.Join(relPath, latestFilename),
|
||||
Config: path.Join("deploys", name, "config", "config.json"),
|
||||
Config: path.Join(h.deployPath, name, "config", "config.json"),
|
||||
},
|
||||
targets,
|
||||
))
|
||||
@ -346,10 +346,10 @@ func (h *houstonHandler) GetLogFileLinks(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
if version == "latest" {
|
||||
version, _ = shared.FindLastestVersion(path.Join("downloads", name))
|
||||
version, _ = shared.FindLastestVersion(path.Join(h.downloadPath, name))
|
||||
}
|
||||
|
||||
root := path.Join("downloads", name, version)
|
||||
root := path.Join(h.downloadPath, name, version)
|
||||
logfiles, err := os.ReadDir(root)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
|
||||
Reference in New Issue
Block a user