conf

package
v0.0.0-...-8062269 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Conf config
	Conf = &Config{}
)

Functions

func Init

func Init() (err error)

Init init config.

Types

type Backoff

type Backoff struct {
	MaxDelay  int32
	BaseDelay int32
	Factor    float32
	Jitter    float32
}

Backoff backoff.

type Config

type Config struct {
	Env        *Env
	Discovery  *Discovery
	RPCClient  *RPCClient
	RPCServer  *RPCServer
	HTTPServer *HTTPServer
	Nsq        *Nsq
	Redis      *Redis
	Node       *Node
	Backoff    *Backoff
	Regions    map[string][]string
}

Config config.

func (*Config) DiscoveryConfig

func (c *Config) DiscoveryConfig() *naming.Config

DiscoveryConfig 创建发现服务配置

func (*Config) Set

func (c *Config) Set(content string) (err error)

Set config setter.

type Discovery

type Discovery struct {
	Nodes []string
}

Discovery is discovery config.

type Env

type Env struct {
	Region    string
	Zone      string
	DeployEnv string
	Host      string
	Weight    int64
}

Env is env config.

type HTTPServer

type HTTPServer struct {
	Network      string
	Addr         string
	ReadTimeout  xtime.Duration
	WriteTimeout xtime.Duration
}

HTTPServer is http server config.

type Node

type Node struct {
	DefaultDomain string
	HostDomain    string
	TCPPort       int
	WSPort        int
	WSSPort       int
	HeartbeatMax  int
	Heartbeat     xtime.Duration
	RegionWeight  float64
}

Node node config.

type Nsq

type Nsq struct {
	Topic   string
	Address string
}

Nsq .

type RPCClient

type RPCClient struct {
	Dial    xtime.Duration
	Timeout xtime.Duration
}

RPCClient is RPC client config.

type RPCServer

type RPCServer struct {
	Network           string
	Addr              string
	Timeout           xtime.Duration
	IdleTimeout       xtime.Duration
	MaxLifeTime       xtime.Duration
	ForceCloseWait    xtime.Duration
	KeepAliveInterval xtime.Duration
	KeepAliveTimeout  xtime.Duration
}

RPCServer is RPC server config.

type Redis

type Redis struct {
	Network      string
	Addr         string
	Auth         string
	Active       int
	Idle         int
	DialTimeout  xtime.Duration
	ReadTimeout  xtime.Duration
	WriteTimeout xtime.Duration
	IdleTimeout  xtime.Duration
	Expire       xtime.Duration
}

Redis .

Jump to

Keyboard shortcuts

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