From 921e886e71d1eae1f9f9d73a1d17c4c1d14f0d52 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Tue, 6 Jun 2023 16:03:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BA=94=E7=94=A8=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=B7=AF=E5=BE=84=E4=BF=AE=E6=94=B9=20(#1267?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/app_install.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/backend/app/service/app_install.go b/backend/app/service/app_install.go index c617e5e28..2dd243dda 100644 --- a/backend/app/service/app_install.go +++ b/backend/app/service/app_install.go @@ -4,9 +4,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/1Panel-dev/1Panel/backend/i18n" - "github.com/1Panel-dev/1Panel/backend/utils/files" - "gopkg.in/yaml.v3" "math" "os" "path" @@ -14,6 +11,10 @@ import ( "strconv" "strings" + "github.com/1Panel-dev/1Panel/backend/i18n" + "github.com/1Panel-dev/1Panel/backend/utils/files" + "gopkg.in/yaml.v3" + "github.com/1Panel-dev/1Panel/backend/utils/env" "github.com/1Panel-dev/1Panel/backend/utils/nginx" "github.com/joho/godotenv" @@ -498,7 +499,16 @@ func (a *AppInstallService) GetDefaultConfigByKey(key string) (string, error) { if err != nil { return "", err } - filePath := path.Join(constant.AppResourceDir, appInstall.App.Key, "versions", appInstall.Version, "conf") + + fileOp := files.NewFileOp() + filePath := path.Join(constant.AppResourceDir, "remote", appInstall.App.Key, appInstall.Version, "conf") + if !fileOp.Stat(filePath) { + filePath = path.Join(constant.AppResourceDir, appInstall.App.Key, "versions", appInstall.Version, "conf") + } + if !fileOp.Stat(filePath) { + return "", buserr.New(constant.ErrPathNotFound) + } + if key == constant.AppMysql { filePath = path.Join(filePath, "my.cnf") }