This commit is contained in:
wangchuxiao 2022-11-10 14:51:35 +08:00
parent 1a93592253
commit bb1babad11
6 changed files with 27 additions and 30 deletions

2
.env
View File

@ -1,3 +1,3 @@
USER=root
PASSWORD=openIM
PASSWORD=openIM123
DATA_DIR=./

View File

@ -10,12 +10,10 @@ etcd:
userName:
password:
k8sMod: false #开启k8s模式 使用pod里面环境变量请求services调用服务 而并非etcd
mysql:
dbMysqlAddress: [ 127.0.0.1:13306 ] #mysql地址 目前仅支持单机,默认即可
dbMysqlUserName: root #mysql用户名建议修改
dbMysqlPassword: openIM # mysql密码建议修改
dbMysqlUserName: #mysql用户名建议修改
dbMysqlPassword: # mysql密码建议修改
dbMysqlDatabaseName: openIM_v2 #默认即可
dbTableName: eMsg #默认即可
dbMsgTableNum: 1
@ -33,8 +31,8 @@ mongo:
dbTimeout: 60
dbDatabase: openIM #mongo db 默认即可
dbSource: admin
dbUserName: root #mongo用户名建议先不设置
dbPassword: openIM #mongo密码建议先不设置
dbUserName: #mongo用户名建议先不设置
dbPassword: #mongo密码建议先不设置
dbMaxPoolSize: 100
dbRetainChatRecords: 3650 #mongo保存离线消息时间根据需求修改
chatRecordsClearTime: "* * * * *" # 每天凌晨3点清除消息该配置和linux定时任务一样 清理操作建议设置在用户活跃少的时候 # 0 3 * * *
@ -45,7 +43,7 @@ redis:
dbMaxActive: 0
dbIdleTimeout: 120
dbUserName: #only redis version 6.0+ need username
dbPassWord: openIM #redis密码 建议修改
dbPassWord: #redis密码 建议修改
enableCluster: false #如果外部redis以集群方式启动需要打开此开关
kafka:
@ -125,8 +123,8 @@ credential: #腾讯cos发送图片、视频、文件时需要请自行申
endpoint: http://127.0.0.1:10005 #minio外网ip 这个ip是给客户端访问的
endpointInner: http://127.0.0.1:10005 #minio内网地址 如果im server 可以通过内网访问到 minio就可以
endpointInnerEnable: true #是否启用minio内网地址 启用可以让桶初始化IM server连接minio走内网地址访问
accessKeyID: user12345
secretAccessKey: key12345
accessKeyID:
secretAccessKey:
storageTime: 50 #文件在minio中保存的时间
isDistributedMod: false # 是否分布式多硬盘部署 默认docker-compose中为false
ali: # ali oss
@ -149,8 +147,6 @@ credential: #腾讯cos发送图片、视频、文件时需要请自行申
externalId: AssumeRoleExtend #角色扩展Id
roleSessionName: Required-AWS-ID-OPENIM #角色SESSION名称
dtm:
serverURL: 127.0.0.1:10007
rpcport: #rpc服务端口 默认即可
openImUserPort: [ 10110 ]
@ -221,19 +217,19 @@ push:
android:
accessID: 111
secretKey: 111
enable: false
enable: false # true or false (bool)
jpns: #极光推送 在极光后台申请后,修改以下四项,必须修改
appKey: cf47465a368f24c659608e7e
masterSecret: 02204efe3f3832947a236ee5
pushUrl: "https://api.jpush.cn/v3/push"
pushIntent: "intent:#Intent;component=io.openim.app.enterprisechat/io.openim.app.enterprisechat.MainActivity;end"
enable: true
enable: false # true or false (bool)
getui: #个推推送
pushUrl: "https://restapi.getui.com/v2/$appId"
masterSecret: ""
appKey: ""
intent: ""
enable: false
enable: # true or false (bool)
channelID: ""
channelName: ""
fcm: #firebase cloud message 消息推送

View File

@ -11,7 +11,7 @@ mongo:
dbPassword: openIM123 #mongo密码建议先不设置
redis:
dbUserName: root
dbUserName:
dbPassWord: openIM123 #redis密码 建议修改
kafka:
@ -20,8 +20,8 @@ kafka:
credential:
minio:
accessKeyID: user12345
secretAccessKey: key12345
accessKeyID: root
secretAccessKey: openIM123
messageverify:
friendVerify: false

View File

@ -36,7 +36,7 @@ func Init(rpcPort int) {
func init() {
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
statistics.NewStatistics(&successCount, config.Config.ModuleName.PushName, fmt.Sprintf("%d second push to msg_gateway count", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
if config.Config.Push.Getui.Enable {
if *config.Config.Push.Getui.Enable {
offlinePusher = getui.GetuiClient
}
if config.Config.Push.Jpns.Enable {

View File

@ -105,7 +105,7 @@ func (rpc *rpcChat) messageVerification(data *pbChat.SendMsgReq) (bool, int32, s
if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin {
return true, 0, "", nil
}
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
log.NewDebug(data.OperationID, *config.Config.MessageVerify.FriendVerify)
reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
if etcdConn == nil {
@ -127,8 +127,8 @@ func (rpc *rpcChat) messageVerification(data *pbChat.SendMsgReq) (bool, int32, s
}
}
}
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
if config.Config.MessageVerify.FriendVerify {
log.NewDebug(data.OperationID, *config.Config.MessageVerify.FriendVerify)
if *config.Config.MessageVerify.FriendVerify {
reqGetFriendIDListFromCache := &cacheRpc.GetFriendIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
if etcdConn == nil {

View File

@ -86,10 +86,6 @@ type config struct {
} `yaml:"aws"`
}
Dtm struct {
ServerURL string `json:"serverURL"`
}
Mysql struct {
DBAddress []string `yaml:"dbMysqlAddress"`
DBUserName string `yaml:"dbMysqlUserName"`
@ -206,7 +202,7 @@ type config struct {
Getui struct {
PushUrl string `yaml:"pushUrl"`
AppKey string `yaml:"appKey"`
Enable bool `yaml:"enable"`
Enable *bool `yaml:"enable"`
Intent string `yaml:"intent"`
MasterSecret string `yaml:"masterSecret"`
ChannelID string `yaml:"channelID"`
@ -269,7 +265,7 @@ type config struct {
AccessExpire int64 `yaml:"accessExpire"`
}
MessageVerify struct {
FriendVerify bool `yaml:"friendVerify"`
FriendVerify *bool `yaml:"friendVerify"`
}
IOSPush struct {
PushSound string `yaml:"pushSound"`
@ -685,11 +681,16 @@ func init() {
if Config.Credential.Minio.SecretAccessKey == "" {
Config.Credential.Minio.SecretAccessKey = UsualConfig.Credential.Minio.SecretAccessKey
}
Config.MessageVerify.FriendVerify = UsualConfig.Messageverify.FriendVerify
if Config.MessageVerify.FriendVerify == nil {
Config.MessageVerify.FriendVerify = &UsualConfig.Messageverify.FriendVerify
}
if Config.Push.Getui.MasterSecret == "" {
Config.Push.Getui.MasterSecret = UsualConfig.Push.Getui.MasterSecret
Config.Push.Getui.AppKey = UsualConfig.Push.Getui.AppKey
}
Config.Push.Getui.Enable = UsualConfig.Push.Getui.Enable
if Config.Push.Getui.Enable == nil {
Config.Push.Getui.Enable = &UsualConfig.Push.Getui.Enable
}
}