1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-16 18:54:43 +08:00

fix: 应用默认配置路径修改 (#1267)

This commit is contained in:
ssongliu 2023-06-06 16:03:22 +08:00 committed by GitHub
parent 9fc4cad80e
commit 921e886e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,9 +4,6 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/1Panel-dev/1Panel/backend/i18n"
"github.com/1Panel-dev/1Panel/backend/utils/files"
"gopkg.in/yaml.v3"
"math" "math"
"os" "os"
"path" "path"
@ -14,6 +11,10 @@ import (
"strconv" "strconv"
"strings" "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/env"
"github.com/1Panel-dev/1Panel/backend/utils/nginx" "github.com/1Panel-dev/1Panel/backend/utils/nginx"
"github.com/joho/godotenv" "github.com/joho/godotenv"
@ -498,7 +499,16 @@ func (a *AppInstallService) GetDefaultConfigByKey(key string) (string, error) {
if err != nil { if err != nil {
return "", err 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 { if key == constant.AppMysql {
filePath = path.Join(filePath, "my.cnf") filePath = path.Join(filePath, "my.cnf")
} }