Documentation ¶
Index ¶
- Constants
- Variables
- func GetServiceFlags(service string, port uint) []cli.Flag
- type Consul
- type Conversation
- type Gateway
- type IMConf
- type Jaeger
- type Logger
- type Msgbroker
- type Msghub
- type Msgid
- type Nats
- type Option
- func WithConsulServer(consulServer string) Option
- func WithConsulServers(consulServers ...string) Option
- func WithIp(ip string) Option
- func WithJeagerAgentHostPort(trackAgentHostPort string) Option
- func WithLogger(logger logger.Logger) Option
- func WithLoggerLevel(level int8) Option
- func WithLogrPath(path string) Option
- func WithNatsDisableJetstream() Option
- func WithNatsServer(natsServer string) Option
- func WithNatsServers(natsServers ...string) Option
- func WithOpenTracing(disable bool) Option
- func WithPort(port uint16) Option
- func WithUseConsulRegistry(useConsulRegistry bool) Option
- type Persistence
- type Postgres
- type Redis
- type RethinkDb
- type ServiceConfig
- type Services
Constants ¶
View Source
const ( // 接口通信密钥 ServiceKey = "quick-im" // Nats流名称 NatsStreamName = "QUICKIM_MSG_STREAM" // 消息订阅主题前缀 MqMsgPrefix = "quickim.msg.>" // 消息持久化组件加入同一个订阅组,随机一个进行消费 MqMsgPersistenceGroup = "quickim.msg.persistence" // 消息网关单独订阅一个主题,每一个网关都接受消息 MqMsgBrokerSubject = "quickim.msg.msgbroker" // 消息持久化表 RethinkMsgDb = "msg" // 注册中心服务前缀 ServerPrefix = "quick.im.instance.1" // TLS证书 PublicCert = "cert/server.crt" PriviteCert = "cert/server.key" // 服务名称 ConversationSerName = "conversation" MsgbrokerSerName = "msgbroker" MsghubSerName = "msghub" MsgIdSerName = "msgid" PersistenceSerName = "persistence" GatewayName = "gateway" )
Variables ¶
View Source
var ConsulFlags = []cli.Flag{ &cli.StringSliceFlag{ Name: "consul.servers", Value: cli.NewStringSlice("127.0.0.1:8500"), Usage: "consul servers", EnvVars: []string{"CONSUL_SERVERS"}, }, }
View Source
var GatewayIpwriteFlags = []cli.Flag{ &cli.StringSliceFlag{ Name: "gateway.ipWrite", Value: cli.NewStringSlice("0.0.0.0/0"), Usage: "gateway ipwrite", EnvVars: []string{"IP_WRITE"}, }, &cli.StringFlag{ Name: "gateway.jwtKey", Value: "quickimkey", Usage: "gateway jwt key", Required: true, EnvVars: []string{"GATEWAY_JWT_KEY"}, }, }
View Source
var JaegerFlags = []cli.Flag{ &cli.BoolFlag{ Name: "jaeger.enable", Value: false, Usage: "jaeger enable", EnvVars: []string{"JAEGER_ENABLE"}, }, &cli.StringFlag{ Name: "jaeger.host", Value: "127.0.0.1", Usage: "jaeger host", EnvVars: []string{"JAEGER_HOST"}, }, &cli.UintFlag{ Name: "jaeger.port", Value: 6832, Usage: "jaeger port", EnvVars: []string{"JAEGER_PORT"}, }, }
View Source
var LogFlags = []cli.Flag{ &cli.StringFlag{ Name: "log.path", Value: "./logs/", Usage: "日志文件路径", EnvVars: []string{"LOG_PATH"}, }, &cli.IntFlag{ Name: "log.level", Value: -1, Usage: `日志记录等级: -1:DebugLevel 1:InfoLevel 2:WarnLevel 3:ErrorLevel 4:DPanicLevel 5:PanicLevel 6:FatalLevel `, EnvVars: []string{"LOG_LEVEL"}, }, }
View Source
var NatsFlags = []cli.Flag{ &cli.StringSliceFlag{ Name: "nats.servers", Value: cli.NewStringSlice("127.0.0.1:4222"), Usage: "nats servers", EnvVars: []string{"NATS_SERVERS"}, }, }
View Source
var PgFlags = []cli.Flag{ &cli.StringFlag{ Name: "pg.host", Value: "127.0.0.1", Usage: "postgres host", EnvVars: []string{"PG_HOST"}, }, &cli.UintFlag{ Name: "pg.port", Value: 5432, Usage: "postgres port", EnvVars: []string{"PG_PORT"}, }, &cli.StringFlag{ Name: "pg.username", Value: "postgres", Usage: "postgres username", EnvVars: []string{"PG_USERNAME"}, }, &cli.StringFlag{ Name: "pg.password", Value: "123456", Usage: "postgres password", EnvVars: []string{"PG_PASSWORD"}, }, &cli.StringFlag{ Name: "pg.dbname", Value: "quickim", Usage: "postgres dbname", EnvVars: []string{"PG_DBNAME"}, }, }
View Source
var RedisFlags = []cli.Flag{ &cli.StringFlag{ Name: "redis.host", Value: "127.0.0.1", Usage: "redis host", EnvVars: []string{"REDIS_HOST"}, }, &cli.UintFlag{ Name: "redis.port", Value: 6379, Usage: "redis port", EnvVars: []string{"REDIS_PORT"}, }, &cli.StringFlag{ Name: "redis.username", Value: "", Usage: "redis username", EnvVars: []string{"REDIS_USERNAME"}, }, &cli.StringFlag{ Name: "redis.password", Value: "", Usage: "redis password", EnvVars: []string{"REDIS_PASSWORD"}, }, }
View Source
var RethinkDbFlags = []cli.Flag{ &cli.StringSliceFlag{ Name: "rethinkdb.servers", Value: cli.NewStringSlice( "127.0.0.1:28015", ), Usage: "rethinkdb servers", EnvVars: []string{"RETHINKDB_SERVERS"}, }, &cli.StringFlag{ Name: "rethinkdb.db", Value: "quickim", Usage: "rethinkdb db name", EnvVars: []string{"RETHINKDB_DB"}, }, &cli.StringFlag{ Name: "rethinkdb.authkey", Value: "", Usage: "rethinkdb authkey", EnvVars: []string{"RETHINKDB_AUTHKEY"}, }, &cli.StringFlag{ Name: "rethinkdb.username", Value: "", Usage: "rethinkdb username", EnvVars: []string{"RETHINKDB_USERNAME"}, }, &cli.StringFlag{ Name: "rethinkdb.password", Value: "", Usage: "rethinkdb password", EnvVars: []string{"RETHINKDB_PASSWORD"}, }, }
Functions ¶
func GetServiceFlags ¶
Types ¶
type Conversation ¶
type IMConf ¶
type IMConf struct { OpenTracing bool `toml:"openTracing"` Logger Logger `toml:"logger"` Jaeger Jaeger `toml:"jaeger"` Postgres Postgres `toml:"postgres"` Redis Redis `toml:"redis"` Nats Nats `toml:"nats"` RethinkDb RethinkDb `toml:"rethinkdb"` Consul Consul `toml:"consul"` Gateway Gateway `toml:"gateway"` Services Services `toml:"services"` }
type Option ¶
type Option func(*serviceConfigImpl)
func WithConsulServer ¶
func WithConsulServers ¶
func WithJeagerAgentHostPort ¶
func WithLogger ¶
func WithLoggerLevel ¶
func WithLogrPath ¶
func WithNatsDisableJetstream ¶
func WithNatsDisableJetstream() Option
func WithNatsServer ¶
func WithNatsServers ¶
func WithOpenTracing ¶
func WithUseConsulRegistry ¶
type Persistence ¶
type ServiceConfig ¶
type ServiceConfig interface { GetIp() string GetPort() uint16 GetOpenTracing() bool GetJeagerAgentHostPort() string GetUseConsulRegistry() bool GetConsulServers() []string GetNatsServers() []string GetNatsEnableJetstream() bool GetLogger() logger.Logger }
func NewServer ¶
func NewServer(SERVER_NAME string, opts ...Option) ServiceConfig
type Services ¶
type Services struct { Conversation Conversation `toml:"conversation"` Msgbroker Msgbroker `toml:"msgbroker"` Msghub Msghub `toml:"msghub"` Msgid Msgid `toml:"msgid"` Persistence Persistence `toml:"persistence"` }
Click to show internal directories.
Click to hide internal directories.