conf

package
v0.0.0-...-d9ad550 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RUN_MODE_LOCAL     = "local"
	RUN_MODE_CONTAINER = "container"
	RUN_MODE_K8S       = "k8s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ServiceName   string `yaml:"service_name"`
	RunMode       string // dev test prod
	MaxProc       int
	ServerTick    xtime.Duration
	OnlineTick    xtime.Duration
	LogPath       string
	Env           *Env
	Discovery     *DiscoveryConf
	RPCServer     *RPCServer
	HTTPServer    *HTTPServer
	Kafka         *Kafka
	Redis         *Redis
	Regions       map[string][]string
	Zipkin        *zipkinConf
	MetricsServer struct {
		Addr string
	} `yaml:"metrics_server"`
}

Config .

func LoadConf

func LoadConf(curPath string) (*Config, error)

type DiscoveryConf

type DiscoveryConf struct {
	Addr string
}

type Env

type Env struct {
	Region string
	Zone   string
	Env    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 Kafka

type Kafka struct {
	Topic   string
	Brokers []string
}

Kafka .

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 {
	Addrs        []string
	DialTimeout  xtime.Duration
	ReadTimeout  xtime.Duration
	WriteTimeout xtime.Duration
	PoolSize     int
	PoolTimeout  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