From b1cf3261251df81945eae1c20c5d77e076a9412f Mon Sep 17 00:00:00 2001 From: ysicing Date: Tue, 12 Sep 2023 14:48:59 +0800 Subject: [PATCH] fix(version): fix version show fix version show Signed-off-by: ysicing --- cmd/version/version.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/cmd/version/version.go b/cmd/version/version.go index af277fd6..97f8acf9 100644 --- a/cmd/version/version.go +++ b/cmd/version/version.go @@ -16,6 +16,7 @@ import ( "time" "github.com/easysoft/qcadmin/internal/app/config" + "github.com/ergoapi/util/file" "github.com/ergoapi/util/github" gv "github.com/Masterminds/semver/v3" @@ -196,16 +197,18 @@ func ShowVersion(log logpkg.Logger) { } } - cfg, _ := config.LoadConfig() - if cfg != nil { - vd.Server.ServerType = cfg.Quickon.Type - if cfg.Quickon.DevOps { - vd.Server.ServerType = common.QuickonType(fmt.Sprintf("devops.%s", vd.Server.ServerType)) - } - - qv, err := upgrade.QuchengVersion(cfg.Quickon.DevOps) - if err == nil { - vd.Server.Components = &qv + if file.CheckFileExists(common.GetCustomConfig(common.InitFileName)) { + cfg, _ := config.LoadConfig() + if cfg != nil { + vd.Server.ServerType = cfg.Quickon.Type + if cfg.Quickon.DevOps { + vd.Server.ServerType = common.QuickonType(fmt.Sprintf("devops.%s", vd.Server.ServerType)) + } + + qv, err := upgrade.QuchengVersion(cfg.Quickon.DevOps) + if err == nil { + vd.Server.Components = &qv + } } } if err := prettyPrintVersion(vd, tmpl); err != nil {