conf

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustLoad

func MustLoad(path string, v interface{}, opts ...Option) error

Types

type ApiConf

type ApiConf struct {
	ServiceConf `mapstructure:",squash"`
	Addr        string `json:"Addr,default=:8080"`
	Mode        string `json:"Mode,default=release"`
	Timeout     int64  `json:"Timeout,default=60"`
}

type DbConf

type DbConf struct {
	DSN string `json:"dsn"`
}

type GrpcConf added in v1.1.2

type GrpcConf struct {
	Addr       string `json:"Addr,default=localhost:8081"`
	Mode       string `json:",default=pro,options=dev|test|rt|pre|pro"`
	MetricsUrl string `json:",optional"`
	// Deprecated: please use DevServer
	Prometheus   prometheus.Config `json:",optional"`
	Telemetry    trace.Config      `json:",optional"`
	Auth         bool              `json:",optional"`
	Timeout      int64             `json:",default=2000"`
	CpuThreshold int64             `json:",default=900,range=[0:1000]"`
	// grpc health check switch
	Health      bool `json:",default=true"`
	Middlewares zrpc.ServerMiddlewaresConf
}

type JwtAuth

type JwtAuth struct {
	Secret string `json:"Secret"`
}

type Option

type Option func(opt *options)

Option defines the method to customize the config options.

type RedisConf

type RedisConf struct {
	Addr     string `json:"addr,default=127.0.0.1:6379"`
	Pass     string `json:"pass,default="`
	DataBase int64  `json:"database,default=1"`
	Timeout  int64  `json:"timeout,default=60"`
}

type ServiceConf

type ServiceConf struct {
	Name       string `json:"Name"`
	Mode       string `json:"Mode,default=release"`
	MetricsUrl string `json:"MetricsUrl"`
	Prometheus string `json:"Prometheus"`
}

Jump to

Keyboard shortcuts

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