mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 14:29:19 +08:00
Feat: Refactor project's references to shared modules (#672)
* fix: to start im or chat, ZooKeeper must be started first. * fix: msg gateway start output err info Signed-off-by: Gordon <1432970085@qq.com> * fix: msg gateway start output err info Signed-off-by: Gordon <1432970085@qq.com> * chore: package path changes Signed-off-by: withchao <993506633@qq.com> * fix: go mod update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * chore: package path changes Signed-off-by: withchao <993506633@qq.com> * chore: package path changes Signed-off-by: withchao <993506633@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> --------- Signed-off-by: Gordon <1432970085@qq.com> Signed-off-by: withchao <993506633@qq.com> Co-authored-by: withchao <993506633@qq.com>
This commit is contained in:
+11
-16
@@ -17,23 +17,18 @@ package config
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"github.com/OpenIMSDK/tools/config"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
)
|
||||
|
||||
//go:embed version
|
||||
var version string
|
||||
|
||||
func init() {
|
||||
config.Version = version
|
||||
}
|
||||
var Version string
|
||||
|
||||
var (
|
||||
_, b, _, _ = runtime.Caller(0)
|
||||
@@ -47,20 +42,20 @@ const (
|
||||
DefaultFolderPath = "../config/"
|
||||
)
|
||||
|
||||
func GetOptionsByNotification(cfg config.NotificationConf) utils.Options {
|
||||
opts := utils.NewOptions()
|
||||
func GetOptionsByNotification(cfg NotificationConf) msgprocessor.Options {
|
||||
opts := msgprocessor.NewOptions()
|
||||
if cfg.UnreadCount {
|
||||
opts = utils.WithOptions(opts, utils.WithUnreadCount(true))
|
||||
opts = msgprocessor.WithOptions(opts, msgprocessor.WithUnreadCount(true))
|
||||
}
|
||||
if cfg.OfflinePush.Enable {
|
||||
opts = utils.WithOptions(opts, utils.WithOfflinePush(true))
|
||||
opts = msgprocessor.WithOptions(opts, msgprocessor.WithOfflinePush(true))
|
||||
}
|
||||
switch cfg.ReliabilityLevel {
|
||||
case constant.UnreliableNotification:
|
||||
case constant.ReliableNotificationNoMsg:
|
||||
opts = utils.WithOptions(opts, utils.WithHistory(true), utils.WithPersistent())
|
||||
opts = msgprocessor.WithOptions(opts, msgprocessor.WithHistory(true), msgprocessor.WithPersistent())
|
||||
}
|
||||
opts = utils.WithOptions(opts, utils.WithSendMsg(cfg.IsSendMsg))
|
||||
opts = msgprocessor.WithOptions(opts, msgprocessor.WithSendMsg(cfg.IsSendMsg))
|
||||
return opts
|
||||
}
|
||||
|
||||
@@ -92,11 +87,11 @@ func initConfig(config interface{}, configName, configFolderPath string) error {
|
||||
}
|
||||
|
||||
func InitConfig(configFolderPath string) error {
|
||||
err := initConfig(&config.Config, FileName, configFolderPath)
|
||||
err := initConfig(&Config, FileName, configFolderPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = initConfig(&config.Config.Notification, NotificationFileName, configFolderPath)
|
||||
err = initConfig(&Config.Notification, NotificationFileName, configFolderPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user