config

package
v0.0.0-...-e40ef66 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OverMaxRetryBehaviorAlive = "alive"
	OverMaxRetryBehaviorDie   = "die"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cert

type Cert struct {
	CertFile string `envconfig:"CERT_FILE"`
	KeyFile  string `envconfig:"KEY_FILE"`
}

type Channels

type Channels []string

func (Channels) MarshalLogArray

func (cs Channels) MarshalLogArray(enc zapcore.ArrayEncoder) error

type Config

type Config struct {
	AccessLog   Log `envconfig:"ACCESS_LOG"`
	ErrorLog    Log `envconfig:"ERROR_LOG"`
	Debug       bool
	Origin      string
	Port        string `default:"8080"`
	GrpcPort    string `default:"50051"`
	MerticsPort string `default:"9999"`
	SSE         ServerSentEvent
	Subscriber  Subscriber
	TLS         Cert `envconfig:"TLS"`
	Metrics     Metrics
	Pprof       Pprof
}

func New

func New() Config

type Log

type Log struct {
	Out   string
	Level string
}

type LogMetrics

type LogMetrics struct {
	Out      string        `default:"stdout"`
	Prefix   string        `default:"metrics"`
	Flag     int           `default:"4"`
	Interval time.Duration `default:"1m"`
}

type Metrics

type Metrics struct {
	Type     string
	Log      LogMetrics
	Syslog   SyslogMetrics
	Interval time.Duration `default:"10s"`
}

type Mock

type Mock struct {
	Interval time.Duration `default:"1s"`
}

type OverMaxRetryBehavior

type OverMaxRetryBehavior struct {
	Type string
}

func (*OverMaxRetryBehavior) UnmarshalText

func (b *OverMaxRetryBehavior) UnmarshalText(text []byte) error

type Pprof

type Pprof struct {
	Host string `default:"0.0.0.0"`
	Port string `default:"6060"`
}

type Redis

type Redis struct {
	Addr                 string `default:"localhost:6379"`
	Password             string
	DB                   int
	Channels             Channels
	OverMaxRetryBehavior OverMaxRetryBehavior `envconfig:"OVER_MAX_RETRY_BEHAVIOR"`
	MaxRetry             int                  `default:"5"`
	Timeout              time.Duration        `default:"1s"`
	RetryInterval        time.Duration        `default:"5s" envconfig:"RETRY_INTERVAL"`
}

func (Redis) MarshalLogObject

func (r Redis) MarshalLogObject(enc zapcore.ObjectEncoder) error

type ServerSentEvent

type ServerSentEvent struct {
	Retry      int    `default:"2000"`
	EventQuery string `default:"eventType"`
}

type Subscriber

type Subscriber struct {
	Type  string `default:"mock"`
	Redis Redis
	Mock  Mock
}

type SyslogMetrics

type SyslogMetrics struct {
	Tag      string        `default:"plasma"`
	Interval time.Duration `default:"1m"`
	Severity int           `default:"6"`
	Facility int
	Network  string
	Addr     string
}

Jump to

Keyboard shortcuts

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