하드코딩된 폴더들 const로 뺌
This commit is contained in:
@ -20,9 +20,15 @@ import (
|
||||
현재 접속 중인 Agent 목록을 보여줍니다.
|
||||
- http method : GET
|
||||
*/
|
||||
const (
|
||||
sub_folder_name_deploys = string("_deploys")
|
||||
sub_folder_name_downloads = string("_downloads")
|
||||
)
|
||||
|
||||
func (h *houstonHandler) GetAgents(w http.ResponseWriter, r *http.Request) {
|
||||
enc := json.NewEncoder(w)
|
||||
enc.Encode(h.Operation().Hosts())
|
||||
allHosts := h.Operation().Hosts()
|
||||
enc.Encode(allHosts)
|
||||
}
|
||||
|
||||
func (h *houstonHandler) GetDeploySources(w http.ResponseWriter, r *http.Request) {
|
||||
@ -84,7 +90,7 @@ func (h *houstonHandler) UploadDeploySource(w http.ResponseWriter, r *http.Reque
|
||||
var filename string
|
||||
|
||||
if version == "config" {
|
||||
filename = path.Join(h.deployPath, name, version, "config.json")
|
||||
filename = path.Join(h.deployPath, name, version, "config"+ext)
|
||||
} else {
|
||||
// deploys 폴더는 파일시스템 서비스이므로 다운로드 가능
|
||||
filename = path.Join(h.deployPath, name, version, name+ext)
|
||||
@ -180,14 +186,14 @@ func (h *houstonHandler) Deploy(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
configPath := ""
|
||||
if _, err := os.Stat(path.Join(h.deployPath, name, "config", "config.json")); err == nil || errors.Is(err, fs.ErrExist) {
|
||||
configPath = path.Join("deploys", name, "config", "config.json")
|
||||
configPath = path.Join(sub_folder_name_deploys, name, "config", "config.json")
|
||||
}
|
||||
|
||||
h.Operation().Deploy(MakeDeployRequest(
|
||||
shared.DeployRequest{
|
||||
Name: name,
|
||||
Version: version,
|
||||
Url: path.Join("deploys", name, version, latestFilename),
|
||||
Url: path.Join(sub_folder_name_deploys, name, version, latestFilename),
|
||||
Config: configPath,
|
||||
},
|
||||
targets,
|
||||
@ -357,7 +363,7 @@ func (h *houstonHandler) GetLogFileLinks(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
var out []string
|
||||
for _, lf := range logfiles {
|
||||
out = append(out, path.Join("downloads", name, version, lf.Name()))
|
||||
out = append(out, path.Join(sub_folder_name_downloads, name, version, lf.Name()))
|
||||
}
|
||||
|
||||
enc := json.NewEncoder(w)
|
||||
|
||||
Reference in New Issue
Block a user