From 7415dff32c8a72f33135599809e3f407f244944d Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Sat, 4 Jan 2025 11:41:12 +0800 Subject: [PATCH] fix: resolving v3.8.3 conflicts --- config/openim-rpc-third.yml | 7 ++ go.sum | 4 +- pkg/common/config/config.go | 141 ++++++++++++++++++++++++++++++++++-- 3 files changed, 142 insertions(+), 10 deletions(-) diff --git a/config/openim-rpc-third.yml b/config/openim-rpc-third.yml index d8f2d427f..639affe5b 100644 --- a/config/openim-rpc-third.yml +++ b/config/openim-rpc-third.yml @@ -38,3 +38,10 @@ object: accessKeySecret: sessionToken: publicRead: false + aws: + region: ap-southeast-2 + bucket: testdemo832234 + accessKeyID: + secretAccessKey: + sessionToken: + publicRead: false diff --git a/go.sum b/go.sum index 392460d0e..bfe6d2928 100644 --- a/go.sum +++ b/go.sum @@ -317,8 +317,8 @@ github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v1.25.0 h1:Vw7br2PCDYijJHSfBOWhov+8cAnUf8MfMaIOV323l6Y= github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= -github.com/openimsdk/gomake v0.0.15-alpha.2 h1:5Q8yl8ezy2yx+q8/ucU/t4kJnDfCzNOrkXcDACCqtyM= -github.com/openimsdk/gomake v0.0.15-alpha.2/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= +github.com/openimsdk/gomake v0.0.14-alpha.5 h1:VY9c5x515lTfmdhhPjMvR3BBRrRquAUCFsz7t7vbv7Y= +github.com/openimsdk/gomake v0.0.14-alpha.5/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= github.com/openimsdk/protocol v0.0.72-alpha.70 h1:j7vB81+rTthijRda2b8tlli9oWvPxr4yXHwZ8nPZIBQ= github.com/openimsdk/protocol v0.0.72-alpha.70/go.mod h1:Iet+piS/jaS+kWWyj6EEr36mk4ISzIRYjoMSVA4dq2M= github.com/openimsdk/tools v0.0.50-alpha.63 h1:dPoVvg4KWqYX/xtK3j96TwX2A/4jwT5S5XIHvSM9hTY= diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index fa571e9f2..b4d77f394 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -15,6 +15,7 @@ package config import ( + "github.com/openimsdk/tools/s3/aws" "strings" "time" @@ -290,14 +291,7 @@ type Third struct { Cos Cos `mapstructure:"cos"` Oss Oss `mapstructure:"oss"` Kodo Kodo `mapstructure:"kodo"` - Aws struct { - Endpoint string `mapstructure:"endpoint"` - Region string `mapstructure:"region"` - Bucket string `mapstructure:"bucket"` - AccessKeyID string `mapstructure:"accessKeyID"` - AccessKeySecret string `mapstructure:"accessKeySecret"` - PublicRead bool `mapstructure:"publicRead"` - } `mapstructure:"aws"` + Aws Aws `mapstructure:"aws"` } `mapstructure:"object"` } type Cos struct { @@ -327,6 +321,15 @@ type Kodo struct { PublicRead bool `mapstructure:"publicRead"` } +type Aws struct { + Endpoint string `mapstructure:"endpoint"` + Region string `mapstructure:"region"` + Bucket string `mapstructure:"bucket"` + AccessKeyID string `mapstructure:"accessKeyID"` + SecretAccessKey string `mapstructure:"secretAccessKey"` + SessionToken string `mapstructure:"sessionToken"` +} + type User struct { RPC struct { RegisterIP string `mapstructure:"registerIP"` @@ -567,6 +570,16 @@ func (o *Kodo) Build() *kodo.Config { } } +func (o *Aws) Build() *aws.Config { + return &aws.Config{ + Region: o.Region, + Bucket: o.Bucket, + AccessKeyID: o.AccessKeyID, + SecretAccessKey: o.SecretAccessKey, + SessionToken: o.SessionToken, + } +} + func (l *CacheConfig) Failed() time.Duration { return time.Second * time.Duration(l.FailedExpire) } @@ -578,3 +591,115 @@ func (l *CacheConfig) Success() time.Duration { func (l *CacheConfig) Enable() bool { return l.Topic != "" && l.SlotNum > 0 && l.SlotSize > 0 } + +var ( + DiscoveryConfigFilename = "discovery.yml" + KafkaConfigFileName = "kafka.yml" + LocalCacheConfigFileName = "local-cache.yml" + LogConfigFileName = "log.yml" + MinioConfigFileName = "minio.yml" + MongodbConfigFileName = "mongodb.yml" + OpenIMAPICfgFileName = "openim-api.yml" + OpenIMCronTaskCfgFileName = "openim-crontask.yml" + OpenIMMsgGatewayCfgFileName = "openim-msggateway.yml" + OpenIMMsgTransferCfgFileName = "openim-msgtransfer.yml" + OpenIMPushCfgFileName = "openim-push.yml" + OpenIMRPCAuthCfgFileName = "openim-rpc-auth.yml" + OpenIMRPCConversationCfgFileName = "openim-rpc-conversation.yml" + OpenIMRPCFriendCfgFileName = "openim-rpc-friend.yml" + OpenIMRPCGroupCfgFileName = "openim-rpc-group.yml" + OpenIMRPCMsgCfgFileName = "openim-rpc-msg.yml" + OpenIMRPCThirdCfgFileName = "openim-rpc-third.yml" + OpenIMRPCUserCfgFileName = "openim-rpc-user.yml" + RedisConfigFileName = "redis.yml" + ShareFileName = "share.yml" + WebhooksConfigFileName = "webhooks.yml" +) + +func (d *Discovery) GetConfigFileName() string { + return DiscoveryConfigFilename +} + +func (k *Kafka) GetConfigFileName() string { + return KafkaConfigFileName +} + +func (lc *LocalCache) GetConfigFileName() string { + return LocalCacheConfigFileName +} + +func (l *Log) GetConfigFileName() string { + return LogConfigFileName +} + +func (m *Minio) GetConfigFileName() string { + return MinioConfigFileName +} + +func (m *Mongo) GetConfigFileName() string { + return MongodbConfigFileName +} + +func (n *Notification) GetConfigFileName() string { + return NotificationFileName +} + +func (a *API) GetConfigFileName() string { + return OpenIMAPICfgFileName +} + +func (ct *CronTask) GetConfigFileName() string { + return OpenIMCronTaskCfgFileName +} + +func (mg *MsgGateway) GetConfigFileName() string { + return OpenIMMsgGatewayCfgFileName +} + +func (mt *MsgTransfer) GetConfigFileName() string { + return OpenIMMsgTransferCfgFileName +} + +func (p *Push) GetConfigFileName() string { + return OpenIMPushCfgFileName +} + +func (a *Auth) GetConfigFileName() string { + return OpenIMRPCAuthCfgFileName +} + +func (c *Conversation) GetConfigFileName() string { + return OpenIMRPCConversationCfgFileName +} + +func (f *Friend) GetConfigFileName() string { + return OpenIMRPCFriendCfgFileName +} + +func (g *Group) GetConfigFileName() string { + return OpenIMRPCGroupCfgFileName +} + +func (m *Msg) GetConfigFileName() string { + return OpenIMRPCMsgCfgFileName +} + +func (t *Third) GetConfigFileName() string { + return OpenIMRPCThirdCfgFileName +} + +func (u *User) GetConfigFileName() string { + return OpenIMRPCUserCfgFileName +} + +func (r *Redis) GetConfigFileName() string { + return RedisConfigFileName +} + +func (s *Share) GetConfigFileName() string { + return ShareFileName +} + +func (w *Webhooks) GetConfigFileName() string { + return WebhooksConfigFileName +}