From cd2a816095296476c36144b57d11003317ac6079 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Sun, 15 Oct 2023 20:19:08 +0800 Subject: [PATCH] refact(version): change version location --- etc/powerx-example.yaml | 1 + internal/config/config.go | 11 ++++++----- internal/logic/gethomelogic.go | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/etc/powerx-example.yaml b/etc/powerx-example.yaml index 782b7d27..f1491c8a 100644 --- a/etc/powerx-example.yaml +++ b/etc/powerx-example.yaml @@ -1,3 +1,4 @@ +Version: v1.0.0 # 版本 Server: Name: PowerX后台系统 # 服务器名称 Host: 0.0.0.0 # 服务器地址 diff --git a/internal/config/config.go b/internal/config/config.go index 6669399f..07cb02a1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -97,11 +97,12 @@ type Root struct { } type Config struct { - Server rest.RestConf - EtcDir string `json:",optional"` - Log zerox.LogConf - Cors Cors - JWT struct { + Version string + Server rest.RestConf + EtcDir string `json:",optional"` + Log zerox.LogConf + Cors Cors + JWT struct { JWTSecret string MPJWTSecret string WebJWTSecret string diff --git a/internal/logic/gethomelogic.go b/internal/logic/gethomelogic.go index 12670986..1f92df6a 100644 --- a/internal/logic/gethomelogic.go +++ b/internal/logic/gethomelogic.go @@ -27,6 +27,6 @@ func (l *GetHomeLogic) GetHome() (resp *types.GetHomeReply, err error) { return &types.GetHomeReply{ Greet: "Hello, I am PowerX!", Description: "This is awesome! you create me and make me alive", - Version: "V1.0.1", + Version: l.svcCtx.Config.Version, }, nil }