# The class cannot be named by Pascal or camel case.
# If it is not used, the corresponding structure will not be set,
# and it will not be read naturally.
serverversion: 2.3.7
#---------------Infrastructure configuration---------------------#
zookeeper:
  schema: openim  #默认即可
  zkAddr: [ 127.0.0.1:2181 ] #单机部署时，默认即可
  userName:
  password:

mysql:
  dbMysqlAddress: [ 127.0.0.1:13306 ] #mysql地址 目前仅支持单机，默认即可
  dbMysqlUserName: root #mysql用户名，建议修改
  dbMysqlPassword: openIM123 # mysql密码，建议修改
  dbMysqlDatabaseName: openIM_v2 #默认即可
  dbTableName: eMsg #默认即可
  dbMsgTableNum: 1
  dbMaxOpenConns: 100
  dbMaxIdleConns: 10
  dbMaxLifeTime: 5
  logLevel: 4 #1=slient 2=error 3=warn 4=info
  slowThreshold: 500

mongo:
  dbUri: ""#当dbUri值不为空则直接使用该值
  dbAddress: [ 127.0.0.1:37017 ]  #单机时为mongo地址，使用分片集群时，为mongos地址 默认即可
  dbDirect: false
  dbTimeout: 60
  dbDatabase: openIM  #mongo db 默认即可
  dbSource: admin
  dbUserName: root #mongo用户名，建议先不设置
  dbPassword: openIM123  #mongo密码，建议先不设置
  dbMaxPoolSize: 100
  dbRetainChatRecords: 3650 #mongo保存离线消息时间（天），根据需求修改
  chatRecordsClearTime: "0 2 * * 3" # 每周三凌晨2点清除消息，该配置和linux定时任务一样， 清理操作建议设置在用户活跃少的时候 # 0 3 * * *

redis:
  dbAddress: [ 127.0.0.1:16379 ] #redis地址 单机时，填写一个地址即可，使用redis集群时候，填写集群中多个节点地址（主从地址都可以填写，增加容灾能力），默认即可
  dbMaxIdle: 128
  dbMaxActive: 0
  dbIdleTimeout: 120
  dbUserName:     #only redis version 6.0+ need username
  dbPassWord: openIM123 #redis密码 建议修改
  enableCluster: false #如果外部redis以集群方式启动，需要打开此开关

kafka:
  SASLUserName: 
  SASLPassword:
  ws2mschat:
    addr: [ 127.0.0.1:9092 ] #kafka配置，默认即可
    topic: "ws2ms_chat" #用于mongo和mysql保存消息
  msgtomongo:
    addr: [ 127.0.0.1:9092 ] #kafka配置，默认即可
    topic: "msg_to_mongo"
  ms2pschat:
    addr: [ 127.0.0.1:9092 ] #kafka配置，默认即可
    topic: "ms2ps_chat" #消息push
  msgtomodify:
    addr: [ 127.0.0.1:9092 ] #kafka配置，默认即可
    topic: "msg_to_modify"
  consumergroupid:
    msgToTransfer: mongo
    msgToMongo: mongo_ex
    msgToMySql: mysql
    msgToPush: push
    msgToModify: modify


#---------------Internal service configuration---------------------#

# The service ip default is empty,
# automatically obtain the machine's valid network card ip as the service ip,
# otherwise the configuration ip is preferred
#如果是单机模式，用0.0.0.0或者不填，默认即可

#作为rpc时，注册到etcd的地址，单机默认即可，如果是集群部署，需要修改（具体使用内网地址还是外网地址，要依情况而定，目的是api/gateway能访问到）
rpcRegisterIP:
#默认即可
listenIP: 0.0.0.0


api:
  openImApiPort: [ 10002 ] #api服务端口，默认即可，需要开放此端口或做nginx转发
  listenIP: 0.0.0.0

sdk:
  openImSdkWsPort: [ 10003 ] #jssdk服务端口，默认即可，项目中使用jssdk才需开放此端口或做nginx转发
  dataDir: [ ../db/sdk/ ]
  openImWsAddress: ws://127.0.0.1:10001
  openImApiAddress: http://127.0.0.1:10002

#对象存储服务，以下配置二选一，目前支持两种，腾讯云和minio，二者配置好其中一种即可（如果使用minio参考https://doc.rentsoft.cn/#/qa/minio搭建minio服务器）
credential: #腾讯cos，发送图片、视频、文件时需要，请自行申请后替换，必须修改


object:
  enable: minio
  apiURL: http://127.0.0.1:10002/api/third/object?name=
  tencent:
    appID:
    region:
    bucket:
    secretID:
    secretKey:
  minio: #MinIO 发送图片、视频、文件时需要，请自行申请后替换，必须修改。 客户端初始化InitSDK，中 object_storage参数为minio
    tempBucket: "openIM"
    dataBucket: "openIM"
    location: us-east-1
    endpoint: http://127.0.0.1:10005 #minio外网ip 这个ip是给客户端访问的
    accessKeyID: root
    secretAccessKey: openIM123
    isDistributedMod: false # 是否分布式多硬盘部署 默认docker-compose中为false
  ali: # ali oss
    regionID:
    accessKeyID:
    accessKeySecret:
    stsEndpoint:
    ossEndpoint:
    bucket:
    finalHost:
    stsDurationSeconds:
    OssRoleArn:
  aws:
    accessKeyID:                              #AssumeRole用户关联的accessKeyID
    accessKeySecret:                          #AssumeRole用户关联的accessKeySecrect
    region:                                   #分区
    bucket:                                   #桶
    finalHost:                                #对外Host
    roleArn:                                  #RoleArn
    externalId:                               #角色扩展Id
    roleSessionName:                          #角色SESSION名称

rpcport: #rpc服务端口 默认即可
  openImUserPort: [ 10110 ]
  openImFriendPort: [ 10120 ]
  openImMessagePort: [ 10130 ]
  openImMessageGatewayPort: [ 10140 ]
  openImGroupPort: [ 10150 ]
  openImAuthPort: [ 10160 ]
  openImPushPort: [ 10170 ]
  openImConversationPort: [ 10180 ]
  openImRtcPort: [ 10190 ]
  openImThirdPort : [ 10200 ]

rpcregistername: #rpc注册服务名，默认即可
  openImUserName: User
  openImFriendName: Friend
  openImMsgName: Msg
  openImPushName: Push
  openImMessageGatewayName: MessageGateway
  openImGroupName: Group
  openImAuthName: Auth
  openImConversationName: Conversation
  openImRtcName: Rtc
  openImThirdName: Third

log:
  storageLocation: ../logs/
  rotationTime: 24
  remainRotationCount: 2 #日志数量
  #日志级别 6表示全都打印，测试阶段建议设置为6
  remainLogLevel: -1
  stderr: true
  withStack: false
  elasticSearchSwitch: false
  elasticSearchAddr: [ 127.0.0.1:9201 ]
  elasticSearchUser: ""
  elasticSearchPassword: ""

modulename: #日志文件按模块命名，默认即可
  longConnSvrName: msg_gateway
  msgTransferName: msg_transfer
  pushName: push

longconnsvr:
  openImWsPort: [ 10001 ] # ws服务端口，默认即可，要开放此端口或做nginx转发
  websocketMaxConnNum: 10000
  websocketMaxMsgLen: 4096
  websocketTimeOut: 10

## 推送只能开启一个 enable代表开启
push:
  tpns: #腾讯推送，暂未测试 暂不要使用
    ios:
      accessID: 1600018281
      secretKey: 3cd68a77a95b89e5089a1aca523f318f
    android:
      accessID: 111
      secretKey: 111
    enable: false # true or false (bool)
  jpns: #极光推送 在极光后台申请后，修改以下四项，必须修改
    appKey:  
    masterSecret:  
    pushUrl:  
    pushIntent:  
    enable: false # true or false (bool)
  getui:  #个推推送
    pushUrl: "https://restapi.getui.com/v2/$appId"
    masterSecret: ""
    appKey: ""
    intent: ""
    enable: false # true or false (bool)
    channelID: ""
    channelName: ""
  fcm:  #firebase cloud message 消息推送
    serviceAccount: "openim-5c6c0-firebase-adminsdk-ppwol-8765884a78.json" #帐号文件，此处需要改修配置，并且这个文件放在 config目录下
    enable: false

manager:
  #app管理员userID和对应的secret  建议修改。 用于管理后台登录，也可以用户管理后台对应的api
  appManagerUid: [ "openIM123456","openIM654321", "openIM333", "openIMAdmin"]
  nickname: [ "系统通知","openIM654321", "openIM333", "openIMAdmin" ]


secret: tuoyun
# 多端互踢策略
# 1：多平台登录：Android、iOS、Windows、Mac 每种平台只能一个在线，web端可以多个同时在线
multiloginpolicy: 1

#msg log insert to db
chatpersistencemysql: true
#消息缓存时间
msgCacheTimeout: 86400
#群聊已读开启
groupMessageHasReadReceiptEnable: true
#单聊已读开启
singleMessageHasReadReceiptEnable: true

#token config
tokenpolicy:
  accessSecret: "OpenIM_server" #token生成相关，默认即可
  # Token effective time day as a unit
  accessExpire: 90  #token过期时间（天） 默认即可
messageverify:
  friendVerify: false

#ios系统推送声音以及标记计数
iospush:
  pushSound: "xxx"
  badgeCount: true
  production: false

callback:
  # callback url 需要自行更换callback url
  callbackUrl : "http://127.0.0.1:8080/callback"
  # 开启关闭操作前后回调的配置
  callbackBeforeSendSingleMsg:
    enable: false # 回调是否启用
    callbackTimeOut: 2 # 回调超时时间
    callbackFailedContinue: true # 回调超时是否继续执行代码
  callbackAfterSendSingleMsg:
    enable: false
    callbackTimeOut: 2
  callbackBeforeSendGroupMsg:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true
  callbackAfterSendGroupMsg:
    enable: false
    callbackTimeOut: 2
  callbackMsgModify:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true
  callbackUserOnline:
    enable: false
    callbackTimeOut: 2
  callbackUserOffline:
    enable: false
    callbackTimeOut: 2
  callbackUserKickOff:
    enable: false
    callbackTimeOut: 2
  callbackOfflinePush:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true # 回调超时是否继续离线推送
  callbackOnlinePush:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true # 回调超时是否继续离线推送
  callbackSuperGroupOnlinePush:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true # 回调超时是否继续离线推送
  callbackBeforeAddFriend:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true # 回调超时是否继续
  callbackBeforeCreateGroup:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true # 回调超时是否继续
  callbackBeforeMemberJoinGroup:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true # 回调超时是否继续
  callbackBeforeSetGroupMemberInfo:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true # 回调超时是否继续
  callbackSetMessageReactionExtensions:
    enable: false
    callbackTimeOut: 2
    callbackFailedContinue: true # 回调超时是否继续

rtc:
  signalTimeout: 35

# prometheus每个服务监听的端口数量需要和rpc port保持一致
prometheus:
  enable: false
  userPrometheusPort: [ 20110 ]
  friendPrometheusPort: [ 20120 ]
  messagePrometheusPort: [ 20130 ]
  messageGatewayPrometheusPort: [ 20140 ]
  groupPrometheusPort: [ 20150 ]
  authPrometheusPort: [ 20160 ]
  pushPrometheusPort: [ 20170 ]
  conversationPrometheusPort: [ 20230 ]
  rtcPrometheusPort: [ 21300 ]
  messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # 端口数量和 script/path_info.cfg  msg_transfer_service_num保持一致
