diff --git a/config/config.yaml b/config/config.yaml index a92f64180..b82e75f71 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -250,7 +250,7 @@ manager: secrets: [ "openIM1","openIM2", "openIM333", "openIMAdmin"] appSysNotificationName: "系统通知" -secret: tuoyun +secret: # 多端互踢策略 # 1:多平台登录:Android、iOS、Windows、Mac 每种平台只能一个在线,web端可以多个同时在线 multiloginpolicy: 1 @@ -268,11 +268,11 @@ singleMessageHasReadReceiptEnable: true #token config tokenpolicy: - accessSecret: "open_im_server" #token生成相关,默认即可 + accessSecret: #token生成相关,默认即可 # Token effective time day as a unit - accessExpire: 90 #token过期时间(天) 默认即可 + accessExpire: #token过期时间(天) 默认即可 messageverify: - friendVerify: false + friendVerify: # c2c: # callbackBeforeSendMsg: diff --git a/config/usualConfig.yaml b/config/usualConfig.yaml index 5dfe1102f..0c9388e0f 100644 --- a/config/usualConfig.yaml +++ b/config/usualConfig.yaml @@ -20,10 +20,16 @@ kafka: credential: minio: - endpoint: #发图片视频文件需要填写 + endpoint: 127.0.0.1:10005 #发图片视频文件需要填写 accessKeyID: root secretAccessKey: openIM123 +secret: tuoyun + +tokenpolicy: + accessSecret: "open_im_server" #token生成相关,默认即可 + accessExpire: 90 #token过期时间(天) 默认即可 + messageverify: friendVerify: false @@ -31,4 +37,5 @@ push: getui: #个推推送 masterSecret: "" appKey: "" - enable: false \ No newline at end of file + enable: false + diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 3046d490c..6ec806e0b 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -589,17 +589,24 @@ type usualConfig struct { } `yaml:"minio"` } `yaml:"credential"` + Secret string `yaml:"secret"` + + Tokenpolicy struct { + AccessSecret string `yaml:"accessSecret"` + AccessExpire int64 `yaml:"accessExpire"` + } `yaml:"tokenpolicy"` + Messageverify struct { FriendVerify bool `yaml:"friendVerify"` - } + } `yaml:"messageverify"` Push struct { Getui struct { MasterSecret string `yaml:"masterSecret"` AppKey string `yaml:"appKey"` Enable bool `yaml:"enable"` - } - } + } `yaml:"getui"` + } `yaml:"push"` } var UsualConfig usualConfig @@ -697,4 +704,15 @@ func init() { Config.Push.Getui.Enable = &UsualConfig.Push.Getui.Enable } + if Config.Secret == "" { + Config.Secret = UsualConfig.Secret + } + + if Config.TokenPolicy.AccessExpire == 0 { + Config.TokenPolicy.AccessExpire = UsualConfig.Tokenpolicy.AccessExpire + } + if Config.TokenPolicy.AccessSecret == "" { + Config.TokenPolicy.AccessSecret = UsualConfig.Tokenpolicy.AccessSecret + } + }