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.
57 lines
1.1 KiB
57 lines
1.1 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 |
|
Gorm GormConfig |
|
Snowflake SnowflakeConfig |
|
Etcd clientv3.Config |
|
Redis redis.Options |
|
Nats nats.Options |
|
Prometheus PrometheusConfig |
|
} |
|
|
|
type GrpcConfig struct { |
|
Log bool |
|
Address string |
|
NoReflection bool |
|
MaxSendMsgSize string |
|
MaxRecvMsgSize string |
|
ReadBufferSize string |
|
WriteBufferSize string |
|
Register discovery.Server |
|
keepalive GrpcKeepalive |
|
} |
|
|
|
type GrpcKeepalive struct { |
|
IdleTimeout string |
|
ForceCloseWait string |
|
KeepAliveInterval string |
|
KeepAliveTimeout string |
|
MaxLifeTime string |
|
} |
|
|
|
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 |
|
}
|
|
|