config

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfig

type ClientConfig struct {
	ServersDiscovery []*RpcServerConfig `mapstructure:"servers_discovery" json:"servers_discovery" yaml:"servers_discovery"` // 封装了多应用服务发现, gclient针对每个应用创建一个 grpc.ClientConn
	BalancePolicy    string             `mapstructure:"balance_policy" json:"balance_policy" yaml:"balance_policy"`          // 负载均衡策略, 默认为 round_robin
}

type EtcdConfig

type EtcdConfig struct {
	Endpoints            []string `mapstructure:"endpoints" json:"endpoints" yaml:"endpoints"`                                           // 指定 etcd 服务端地址
	DialTimeout          int64    `mapstructure:"dial_timeout" json:"dial_timeout" yaml:"dial_timeout" `                                 // etcd 链接超时时间, 单位 second, 默认5s
	DialKeepAliveTime    int64    `mapstructure:"dial_keep_alive_time" json:"dial_keep_alive_time" yaml:"dial_keep_alive_time"`          // etcd keepalive 时间, 单位second, 默认5s
	DialKeepAliveTimeout int64    `mapstructure:"dial_keep_alive_timeout" json:"dial_keep_alive_timeout" yaml:"dial_keep_alive_timeout"` // etcd keepalive 超时时间, 单位 second, 默认5s
	Username             string   `mapstructure:"username" json:"username" yaml:"username"`                                              // etcd 认证 username
	Password             string   `mapstructure:"password" json:"password" yaml:"password"`                                              // etcd 认证 password
}

type EtcdRegistryConfig

type EtcdRegistryConfig struct {
	Endpoints            []string `mapstructure:"endpoints" json:"endpoints" yaml:"endpoints"`                                           // 指定 etcd 服务端地址
	DialTimeout          int64    `mapstructure:"dial_timeout" json:"dial_timeout" yaml:"dial_timeout"`                                  // etcd 链接超时时间, 单位 second, 默认5s
	DialKeepAliveTime    int64    `mapstructure:"dial_keep_alive_time" json:"dial_keep_alive_time" yaml:"dial_keep_alive_time"`          // etcd keepalive 时间, 单位second, 默认5s
	DialKeepAliveTimeout int64    `mapstructure:"dial_keep_alive_timeout" json:"dial_keep_alive_timeout" yaml:"dial_keep_alive_timeout"` // etcd keepalive 超时时间, 单位 second, 默认5s
	Username             string   `mapstructure:"username" json:"username" yaml:"username"`                                              // etcd 认证 username
	Password             string   `mapstructure:"password" json:"password" yaml:"password"`                                              // etcd 认证 password
	Interval             int64    `mapstructure:"interval" json:"interval" yaml:"interval"`                                              // 注册中心配置, 指定多久检测并重新续约, 默认10s
	LeaseTTL             int64    `mapstructure:"lease_ttl" json:"lease_ttl" yaml:"lease_ttl"`                                           // 注册中心配置, 租约时长, 默认12s
}

type RpcServerConfig

type RpcServerConfig struct {
	ServerApp  string      `mapstructure:"server_app" json:"server_app" yaml:"server_app"`    // 指定要连接的server端的app name
	Schema     string      `mapstructure:"schema" json:"schema" yaml:"schema"`                // 指定registry 类型协议
	EtcdConfig *EtcdConfig `mapstructure:"etcd_config" json:"etcd_config" yaml:"etcd_config"` // etcd 相关配置
}

type ServerConfig

type ServerConfig struct {
	// 公共配置属性
	AppName             string              `mapstructure:"app_name" json:"app_name" yaml:"app_name"`                                     // 服务app name
	Port                int                 `mapstructure:"port" json:"port" yaml:"port"`                                                 // 服务监听的port
	Schema              string              `mapstructure:"schema" json:"schema" yaml:"schema"`                                           // 指定registry 类型
	HealthcheckInterval int                 `mapstructure:"healthcheck_interval" json:"healthcheck_interval" yaml:"healthcheck_interval"` // 指定健康检测的间隔, 单位second
	EtcdRegistryConfig  *EtcdRegistryConfig `mapstructure:"etcd_registry_config" json:"etcd_registry_config" yaml:"etcd_registry_config"` // 指定etc registry的配置

	// 私有化属性
	Logger *zap.Logger `mapstructure:"-" json:"-" yaml:"-"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL