You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

55 lines
1.0 KiB

package config
import (
nats "github.com/nats-io/nats.go"
redis "github.com/redis/go-redis/v9"
clientv3 "go.etcd.io/etcd/client/v3"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"sonet/pkg/grpc/discovery"
)
// Configuration 服务配置
type Configuration struct {
App map[string]any
Grpc GrpcConfig
GrpcClient GrpcClientConfig
Gorm GormConfig
Snowflake SnowflakeConfig
Etcd clientv3.Config
Redis redis.Options
Nats nats.Options
Prometheus PrometheusConfig
}
type GrpcConfig struct {
Address string
NoReflection bool
MaxSendMsgSize string
MaxRecvMsgSize string
ReadBufferSize string
WriteBufferSize string
Register discovery.Server
}
type GrpcKeepaliveConfig struct {
// todo...
}
type GrpcClientConfig struct {
}
type GormConfig struct {
LogMode bool // default false
gorm.Config
Mysql mysql.Config
}
type SnowflakeConfig struct {
NodeId int64 // 0-1023, 相同服务每个部署实例不重复
}
type PrometheusConfig struct {
Enable bool
Port int
}