Documentation ¶
Index ¶
- Variables
- func Load(config interface{}) (err error)
- func LoadDefaultConfig() (err error)
- type AllConfig
- type CacheConfig
- type DbConfig
- type DbStdConfig
- type GrpcConfig
- type GrpcServerConfig
- type HTTPServerConfig
- type LoggerConfig
- type MongoConfig
- type PrometheusConfig
- type RedisConfig
- type RouteConfig
- type ServerConfig
- type SessionConfig
- type TemplateConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConfigPathNotExist = errors.New("config path not exist")
Functions ¶
func LoadDefaultConfig ¶
func LoadDefaultConfig() (err error)
Types ¶
type AllConfig ¶
type AllConfig struct { AppID int64 EnableSession bool //废弃 ErrorBase int64 Server HTTPServerConfig GrpcServer GrpcServerConfig Logger LoggerConfig Db DbConfig Mongo MongoConfig Cache CacheConfig Template TemplateConfig Route RouteConfig Redis RedisConfig Session SessionConfig Prometheus PrometheusConfig Custom map[string]string }
Config 项目配置
var Config AllConfig
type CacheConfig ¶
type CacheConfig struct { Type string Servers []string Config struct { Prefix string Expiration int32 } }
CacheConfig ..
type DbConfig ¶
type DbConfig struct { DbStdConfig MaxIdleConns int MaxOpenConns int KeepAlive time.Duration //缓存配置 CacheType string CacheMaxSize int CacheTimeout time.Duration //从库 Slaves []DbStdConfig }
DbConfig ..
type DbStdConfig ¶
type GrpcConfig ¶
type GrpcConfig struct { //必填,必须保证唯一,且符合证书域名规则(如果使用证书) //如果采用服务发现,则用于服务名 ServerName string //指定tag Tag string //服务发现类型,目前可选static、consul,默认是static ResolverType string //默认ResolverType+ServerName,必须保证在同个项目里所有外部服务都是唯一 ResolverScheme string //服务发现的地址,如consul、etcd地址 ResolverAddresses []string //负载均衡策略名称,支持round_robin、pick_first、p2c,默认是p2c BalancerName string //服务地址,如果ResolverType是static,必填 Addresses []string //调用具有证书的grpc服务,必须要指定客户端证书 CertFile string //是否需要Auth验证 IsAuth bool }
grpc client配置
type HTTPServerConfig ¶
type HTTPServerConfig struct { ServerConfig //并发数量限制 Concurrence uint ReadTimeout time.Duration WriteTimeout time.Duration }
HTTPServerConfig ..
type LoggerConfig ¶
type LoggerConfig struct { LogGoID bool LogFile string LogLevel string IsConsole bool LogType string LogMaxNum int32 LogSize int64 LogUnit string }
LoggerConfig ..
type MongoConfig ¶
type PrometheusConfig ¶
type RedisConfig ¶
type RouteConfig ¶
RouteConfig ..
type ServerConfig ¶
type ServerConfig struct { Address string //证书 CertFile string KeyFile string Phrase string //grpc服务使用 MaxRecvMsgSize int MaxSendMsgSize int //服务注册配置 //服务注册类型,目前可选static、consul,默认是static ResolverType string //服务注册的地址,如consul、etcd地址 ResolverAddresses []string //服务名,必须符合证书的域名规则 ServerName string //隔多久检查一次 UpdateInterval int64 //指定注册的网卡地址,或者在上方的Address里指定ip Interface string Tags []string }
ServerConfig ..
type SessionConfig ¶
Click to show internal directories.
Click to hide internal directories.