mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 11:52:10 +08:00
feat: config build
This commit is contained in:
parent
3053d4a5ce
commit
e0ad9847c5
@ -16,6 +16,8 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/openimsdk/tools/db/mongoutil"
|
||||||
|
"github.com/openimsdk/tools/db/redisutil"
|
||||||
"github.com/openimsdk/tools/mq/kafka"
|
"github.com/openimsdk/tools/mq/kafka"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
"time"
|
"time"
|
||||||
@ -76,6 +78,18 @@ type Mongo struct {
|
|||||||
MaxRetry int `yaml:"maxRetry"`
|
MaxRetry int `yaml:"maxRetry"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Mongo) Build() *mongoutil.Config {
|
||||||
|
return &mongoutil.Config{
|
||||||
|
Uri: m.Uri,
|
||||||
|
Address: m.Address,
|
||||||
|
Database: m.Database,
|
||||||
|
Username: m.Username,
|
||||||
|
Password: m.Password,
|
||||||
|
MaxPoolSize: m.MaxPoolSize,
|
||||||
|
MaxRetry: m.MaxRetry,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type Redis struct {
|
type Redis struct {
|
||||||
ClusterMode bool `yaml:"clusterMode"`
|
ClusterMode bool `yaml:"clusterMode"`
|
||||||
Address []string `yaml:"address"`
|
Address []string `yaml:"address"`
|
||||||
@ -86,6 +100,17 @@ type Redis struct {
|
|||||||
MaxRetry int `yaml:"maxRetry"`
|
MaxRetry int `yaml:"maxRetry"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Redis) Build() *redisutil.Config {
|
||||||
|
return &redisutil.Config{
|
||||||
|
ClusterMode: r.ClusterMode,
|
||||||
|
Address: r.Address,
|
||||||
|
Username: r.Username,
|
||||||
|
Password: r.Password,
|
||||||
|
DB: r.DB,
|
||||||
|
MaxRetry: r.MaxRetry,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type Kafka struct {
|
type Kafka struct {
|
||||||
kafka.Config
|
kafka.Config
|
||||||
LatestMsgToRedis struct {
|
LatestMsgToRedis struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user