conf

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GConfig = &Config{}
)

Functions

func Init

func Init(v *viper.Viper) (err error)

func ServiceName

func ServiceName() string

Types

type AmapServer

type AmapServer struct {
	Key string `mapstructure:"key"`
}

type Bootstrap

type Bootstrap struct {
	Graceful bool   `mapstructure:"graceful"`
	Pid      string `mapstructure:"pid"`
	Timeout  int    `mapstructure:"timeout"`
}

type Commandline

type Commandline struct {
	Graceful bool `mapstructure:"graceful"`
}

type Config

type Config struct {
	Env         string                   `mapstructure:"env"`
	Commandline Commandline              `mapstructure:"commandline"`
	Bootstrap   Bootstrap                `mapstructure:"bootstrap"`
	Transport   Transport                `mapstructure:"transport"`
	Log         log.ConfigLog            `mapstructure:"log"`
	Trace       Trace                    `mapstructure:"trace"`
	HttpServer  HttpServer               `mapstructure:"http_server"`
	HttpBreaker []map[string]interface{} `mapstructure:"http_breaker"`
	ChildServer []map[string]interface{} `mapstructure:"child_server"`
	Redis       []trace_redis.Redis      `mapstructure:"redis"`
	Server      []Server                 `mapstructure:"server"`
	Nsq         Nsq                      `mapstructure:"nsq"`
	Mysql       []db.Mysql               `mapstructure:"mysql"`
	OSS         OSS                      `mapstructure:"oss"`
	LoginUser   []LoginUser              `mapstructure:"login_user"`
	LocalConfig LocalConfig              `mapstructure:"config"`
	AmapServer  AmapServer               `mapstructure:"amap_server"`
}

type Consumer

type Consumer struct {
	Name         string   `mapstructure:"name"`
	Addr         string   `mapstructure:"addr"`
	Lookup       []string `mapstructure:"lookup"`
	MaxInFlight  int32    `mapstructure:"max_inflight"`
	DialTimeout  int32    `mapstructure:"dial_timeout"`
	ReadTimeout  int32    `mapstructure:"read_timeout"`
	WriteTimeout int32    `mapstructure:"write_timeout"`
}

type GrpcConfig

type GrpcConfig struct {
	Addr string `mapstructure:"addr"`
}

type HTTPConfig

type HTTPConfig struct {
	Addr              string  `mapstructure:"addr"`
	MaxConns          int     `mapstructure:"max_conns"`
	ReadTimeout       float64 `mapstructure:"read_timeout"`
	ReadHeaderTimeout float64 `mapstructure:"read_header_timeout"`
	WriteTimeout      float64 `mapstructure:"write_timeout"`
	IdleTimeout       float64 `mapstructure:"idle_timeout"`
}

type HttpServer

type HttpServer struct {
	SelfServiceName string `yaml:"self_service_name" mapstructure:"self_service_name"`
	CloseBreaker    bool   `yaml:"close_breaker" mapstructure:"close_breaker"`
}

type Kv

type Kv struct {
	Url       string `mapstructure:"url"`
	KeyPerfix string `mapstructure:"key_perfix"`
}

type LocalConfig

type LocalConfig struct {
	Env         string `mapstructure:"env"`
	ServiceName string `mapstructure:"service_name"`
}

type Log

type Log struct {
	LogType string `mapstructure:"type"`
	App     struct {
		FilePath string `mapstructure:"file_path"`
		Level    string `mapstructure:"level"`
		Enable   bool   `mapstructure:"enable"`
	} `mapstructure:"app"`

	Access struct {
		FilePath string `mapstructure:"file_path"`
		Enable   bool   `mapstructure:"enable"`
	} `mapstructure:"access"`
}

type LoginUser

type LoginUser struct {
	UserName string `mapstructure:"user_name"`
	UserPwd  string `mapstructure:"user_pwd"`
}

type Nsq

type Nsq struct {
	Producer []Producer `mapstructure:"producer"`
	Consumer []Consumer `mapstructure:"consumer"`
}

type OSS

type OSS struct {
	AK       string `mapstructure:"ak"`
	AS       string `mapstructure:"as"`
	Endpoint string `mapstructure:"endpoint"`
}

type Producer

type Producer struct {
	Name           string `mapstructure:"name"`
	Addr           string `mapstructure:"addr"`
	MaxConcurrency int32  `mapstructure:"max_concurrency"`
	DialTimeout    int32  `mapstructure:"dial_timeout"`
	ReadTimeout    int32  `mapstructure:"read_timeout"`
	WriteTimeout   int32  `mapstructure:"write_timeout"`
}

type Server

type Server struct {
	Name                 string `mapstructure:"name"`
	Url                  string `mapstructure:"url"`
	DiscoveryServiceName string `mapstructure:"discovery_service_name"`
	DiscoveryServicePort int    `mapstructure:"discovery_service_port"`
	DiscoveryTag         string `mapstructure:"discovery_tag"`
	DiscoveryDC          string `mapstructure:"discovery_dc"`
	ConnectSidecar       string `mapstructure:"connect_sidecar"`
	ConnectConsul        string `mapstructure:"connect_consul"`
}

type Trace

type Trace struct {
	ServiceName string  `mapstructure:"service_name"`
	FilePath    string  `mapstructure:"file_path"`
	Sampling    float64 `mapstructure:"sampling"`
}

type Transport

type Transport struct {
	HTTP         HTTPConfig `mapstructure:"http"`
	InnerHTTP    HTTPConfig `mapstructure:"inner_http"`
	CmdInnerHTTP HTTPConfig `mapstructure:"cmd_inner_http"`
	Grpc         GrpcConfig `mapstructure:"grpc"`
}

Jump to

Keyboard shortcuts

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