From fbc34c28477c5cae6117f72a57a08c033e392117 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:07:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=B5=81=E7=A8=8B=20(#2831)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/app_utils.go | 10 ++++++++++ backend/app/service/website_utils.go | 2 +- backend/i18n/lang/en.yaml | 2 +- backend/i18n/lang/zh-Hant.yaml | 2 +- backend/i18n/lang/zh.yaml | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/backend/app/service/app_utils.go b/backend/app/service/app_utils.go index 0d4ce0ba2..e7af44110 100644 --- a/backend/app/service/app_utils.go +++ b/backend/app/service/app_utils.go @@ -419,6 +419,16 @@ func upgradeInstall(installId uint, detailId uint, backup bool) error { _, _ = scriptCmd.CombinedOutput() } + if detail.DockerCompose == "" { + composeDetail, err := fileOp.GetContent(path.Join(detailDir, "docker-compose.yml")) + if err != nil { + upErr = err + return + } + detail.DockerCompose = string(composeDetail) + _ = appDetailRepo.Update(context.Background(), detail) + } + composeMap := make(map[string]interface{}) if upErr = yaml.Unmarshal([]byte(detail.DockerCompose), &composeMap); upErr != nil { return diff --git a/backend/app/service/website_utils.go b/backend/app/service/website_utils.go index 94ce7724f..05e8bd726 100644 --- a/backend/app/service/website_utils.go +++ b/backend/app/service/website_utils.go @@ -40,7 +40,7 @@ func getDomain(domainStr string, defaultPort int) (model.WebsiteDomain, error) { portStr := domainArray[1] portN, err := strconv.Atoi(portStr) if err != nil { - return model.WebsiteDomain{}, buserr.New("ErrTypePort") + return model.WebsiteDomain{}, buserr.WithName("ErrTypePort", portStr) } if portN <= 0 || portN > 65535 { return model.WebsiteDomain{}, buserr.New("ErrTypePortRange") diff --git a/backend/i18n/lang/en.yaml b/backend/i18n/lang/en.yaml index 6a4a7238a..b919e5318 100644 --- a/backend/i18n/lang/en.yaml +++ b/backend/i18n/lang/en.yaml @@ -18,7 +18,7 @@ ErrPortExist: '{{ .port }} port is already occupied by {{ .type }} [{{ .name }}] TYPE_APP: "Application" TYPE_RUNTIME: "Runtime environment" TYPE_DOMAIN: "Domain name" -ErrTypePort: 'Port {{name}} format error' +ErrTypePort: 'Port {{ .name }} format error' ErrTypePortRange: 'Port range needs to be between 1-65535' #app diff --git a/backend/i18n/lang/zh-Hant.yaml b/backend/i18n/lang/zh-Hant.yaml index f5ec24e6c..efcf0981e 100644 --- a/backend/i18n/lang/zh-Hant.yaml +++ b/backend/i18n/lang/zh-Hant.yaml @@ -18,7 +18,7 @@ ErrPortExist: '{{ .port }} 埠已被 {{ .type }} [{{ .name }}] 佔用' TYPE_APP: "應用" TYPE_RUNTIME: "運作環境" TYPE_DOMAIN: "網域名稱" -ErrTypePort: '埠 {{name}} 格式錯誤' +ErrTypePort: '埠 {{ .name }} 格式錯誤' ErrTypePortRange: '連接埠範圍需要在 1-65535 之間' #app diff --git a/backend/i18n/lang/zh.yaml b/backend/i18n/lang/zh.yaml index 1935d459c..3eb223da9 100644 --- a/backend/i18n/lang/zh.yaml +++ b/backend/i18n/lang/zh.yaml @@ -18,7 +18,7 @@ ErrPortExist: '{{ .port }} 端口已被 {{ .type }} [{{ .name }}] 占用' TYPE_APP: "应用" TYPE_RUNTIME: "运行环境" TYPE_DOMAIN: "域名" -ErrTypePort: '端口 {{name}} 格式错误' +ErrTypePort: '端口 {{ .name }} 格式错误' ErrTypePortRange: '端口范围需要在 1-65535 之间' #app