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 }