diff --git a/pkg/common/cmd/api.go b/pkg/common/cmd/api.go index ecdb0dd3a..4088ecd09 100644 --- a/pkg/common/cmd/api.go +++ b/pkg/common/cmd/api.go @@ -16,8 +16,9 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/api" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -38,7 +39,7 @@ func NewApiCmd() *ApiCmd { DiscoveryConfigFilename: &apiConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/auth.go b/pkg/common/cmd/auth.go index 7d75a7da6..b35a95f39 100644 --- a/pkg/common/cmd/auth.go +++ b/pkg/common/cmd/auth.go @@ -16,9 +16,10 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/rpc/auth" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -40,7 +41,7 @@ func NewAuthRpcCmd() *AuthRpcCmd { DiscoveryConfigFilename: &authConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/conversation.go b/pkg/common/cmd/conversation.go index 57ffa52bc..bdb4447f4 100644 --- a/pkg/common/cmd/conversation.go +++ b/pkg/common/cmd/conversation.go @@ -16,9 +16,10 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/rpc/conversation" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -43,7 +44,7 @@ func NewConversationRpcCmd() *ConversationRpcCmd { DiscoveryConfigFilename: &conversationConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/cron_task.go b/pkg/common/cmd/cron_task.go index fd4447524..d6c5e472e 100644 --- a/pkg/common/cmd/cron_task.go +++ b/pkg/common/cmd/cron_task.go @@ -16,8 +16,9 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/tools" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -38,7 +39,7 @@ func NewCronTaskCmd() *CronTaskCmd { DiscoveryConfigFilename: &cronTaskConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/friend.go b/pkg/common/cmd/friend.go index 8be1f7745..1bc9e6c54 100644 --- a/pkg/common/cmd/friend.go +++ b/pkg/common/cmd/friend.go @@ -16,9 +16,10 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/rpc/friend" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -44,7 +45,7 @@ func NewFriendRpcCmd() *FriendRpcCmd { DiscoveryConfigFilename: &friendConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/group.go b/pkg/common/cmd/group.go index 20124be95..9b0fbf8de 100644 --- a/pkg/common/cmd/group.go +++ b/pkg/common/cmd/group.go @@ -16,10 +16,11 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/rpc/group" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" "github.com/openimsdk/open-im-server/v3/pkg/common/storage/versionctx" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -45,7 +46,7 @@ func NewGroupRpcCmd() *GroupRpcCmd { DiscoveryConfigFilename: &groupConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/msg.go b/pkg/common/cmd/msg.go index 91f7931fb..bfd29398e 100644 --- a/pkg/common/cmd/msg.go +++ b/pkg/common/cmd/msg.go @@ -16,9 +16,10 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/rpc/msg" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -45,7 +46,7 @@ func NewMsgRpcCmd() *MsgRpcCmd { DiscoveryConfigFilename: &msgConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/msg_gateway.go b/pkg/common/cmd/msg_gateway.go index 29d3fba33..6363bfbf9 100644 --- a/pkg/common/cmd/msg_gateway.go +++ b/pkg/common/cmd/msg_gateway.go @@ -16,9 +16,9 @@ package cmd import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/internal/msggateway" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" @@ -42,7 +42,7 @@ func NewMsgGatewayCmd() *MsgGatewayCmd { DiscoveryConfigFilename: &msgGatewayConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/msg_transfer.go b/pkg/common/cmd/msg_transfer.go index 0d48281e5..364393413 100644 --- a/pkg/common/cmd/msg_transfer.go +++ b/pkg/common/cmd/msg_transfer.go @@ -16,8 +16,9 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/msgtransfer" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -42,7 +43,7 @@ func NewMsgTransferCmd() *MsgTransferCmd { DiscoveryConfigFilename: &msgTransferConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/push.go b/pkg/common/cmd/push.go index 6e6014021..c9b8b1c24 100644 --- a/pkg/common/cmd/push.go +++ b/pkg/common/cmd/push.go @@ -16,9 +16,10 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/push" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -45,7 +46,7 @@ func NewPushRpcCmd() *PushRpcCmd { DiscoveryConfigFilename: &pushConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { ret.pushConfig.FcmConfigPath = ret.ConfigPath() return ret.runE() diff --git a/pkg/common/cmd/root.go b/pkg/common/cmd/root.go index 84e985697..b43f86557 100644 --- a/pkg/common/cmd/root.go +++ b/pkg/common/cmd/root.go @@ -19,6 +19,7 @@ import ( "path/filepath" "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/spf13/cobra" @@ -138,13 +139,13 @@ func (r *RootCmd) initializeLogger(cmdOpts *CmdOpts) error { r.log.StorageLocation, r.log.RemainRotationCount, r.log.RotationTime, - config.Version, + version.Version, r.log.IsSimplify, ) if err != nil { return errs.Wrap(err) } - return errs.Wrap(log.InitConsoleLogger(r.processName, r.log.RemainLogLevel, r.log.IsJson, config.Version)) + return errs.Wrap(log.InitConsoleLogger(r.processName, r.log.RemainLogLevel, r.log.IsJson, version.Version)) } diff --git a/pkg/common/cmd/third.go b/pkg/common/cmd/third.go index b6731f1ff..a301b738f 100644 --- a/pkg/common/cmd/third.go +++ b/pkg/common/cmd/third.go @@ -16,9 +16,10 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/rpc/third" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -44,7 +45,7 @@ func NewThirdRpcCmd() *ThirdRpcCmd { DiscoveryConfigFilename: &thirdConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/cmd/user.go b/pkg/common/cmd/user.go index 674f9e3a6..9a614afca 100644 --- a/pkg/common/cmd/user.go +++ b/pkg/common/cmd/user.go @@ -16,9 +16,10 @@ package cmd import ( "context" + "github.com/openimsdk/open-im-server/v3/internal/rpc/user" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/startrpc" + "github.com/openimsdk/open-im-server/v3/version" "github.com/openimsdk/tools/system/program" "github.com/spf13/cobra" ) @@ -45,7 +46,7 @@ func NewUserRpcCmd() *UserRpcCmd { DiscoveryConfigFilename: &userConfig.Discovery, } ret.RootCmd = NewRootCmd(program.GetProcessName(), WithConfigMap(ret.configMap)) - ret.ctx = context.WithValue(context.Background(), "version", config.Version) + ret.ctx = context.WithValue(context.Background(), "version", version.Version) ret.Command.RunE = func(cmd *cobra.Command, args []string) error { return ret.runE() } diff --git a/pkg/common/config/parse.go b/pkg/common/config/parse.go index 28e9f5db6..08f82ac7d 100644 --- a/pkg/common/config/parse.go +++ b/pkg/common/config/parse.go @@ -15,7 +15,6 @@ package config import ( - _ "embed" "os" "path/filepath" @@ -26,9 +25,6 @@ import ( "gopkg.in/yaml.v3" ) -//go:embed version -var Version string - const ( FileName = "config.yaml" NotificationFileName = "notification.yaml" diff --git a/pkg/common/config/version b/pkg/common/config/version deleted file mode 100644 index 240bba906..000000000 --- a/pkg/common/config/version +++ /dev/null @@ -1 +0,0 @@ -3.7.0 \ No newline at end of file diff --git a/version/version b/version/version new file mode 100644 index 000000000..0be1fc7d2 --- /dev/null +++ b/version/version @@ -0,0 +1 @@ +3.8.0 \ No newline at end of file diff --git a/version/version.go b/version/version.go new file mode 100644 index 000000000..23b3a82f5 --- /dev/null +++ b/version/version.go @@ -0,0 +1,6 @@ +package version + +import _ "embed" + +//go:embed version +var Version string