config

package
v0.0.0-...-d45fff1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeanstalkConfig

type BeanstalkConfig struct {
	Address string     `yaml:"address"`
	Pool    PoolConfig `yaml:"pool"`
}

type Config

type Config struct {
	Logger    LoggerConfig    `yaml:"logger"`
	Beanstalk BeanstalkConfig `yaml:"beanstalk"`
	Http      HttpConfig      `yaml:"http"`
	Security  SecurityConfig  `yaml:"security"`
}

func Default

func Default() *Config

func Load

func Load(name string) (*Config, error)

func LoadOrDefault

func LoadOrDefault(name string) (*Config, error)

func Unmarshal

func Unmarshal(reader io.Reader) (*Config, error)

type EncoderConfig

type EncoderConfig struct {
	MessageKey       string                  `yaml:"message_key"`
	LevelKey         string                  `yaml:"level_key"`
	TimeKey          string                  `yaml:"time_key"`
	NameKey          string                  `yaml:"name_key"`
	CallerKey        string                  `yaml:"caller_key"`
	FunctionKey      string                  `yaml:"function_key"`
	StacktraceKey    string                  `yaml:"stacktrace_key"`
	LineEnding       string                  `yaml:"line_ending"`
	LevelEncoder     zapcore.LevelEncoder    `yaml:"level_encoder"`
	TimerEncoder     zapcore.TimeEncoder     `yaml:"time_encoder"`
	DurationEncoder  zapcore.DurationEncoder `yaml:"duration_encoder"`
	CallerEncoder    zapcore.CallerEncoder   `yaml:"caller_encoder"`
	NameEncoder      zapcore.NameEncoder     `yaml:"name_encoder"`
	ConsoleSeparator string                  `yaml:"console_separator"`
}

type HttpConfig

type HttpConfig struct {
	ListenAddresses string        `yaml:"listen_addresses"`
	ReadTimeout     time.Duration `yaml:"read_timeout"`
	WriteTimeout    time.Duration `yaml:"write_timeout"`
	IdleTimeout     time.Duration `yaml:"idle_timeout"`
}

type LoggerConfig

type LoggerConfig struct {
	Level         zap.AtomicLevel        `yaml:"level"`
	Encoding      string                 `yaml:"encoding"`
	Encoder       EncoderConfig          `yaml:"encoder"`
	InitialFields map[string]interface{} `yaml:"initial_fields"`
}

type PoolConfig

type PoolConfig struct {
	Capacity    int           `yaml:"capacity"`
	MaxAge      time.Duration `yaml:"max_age"`
	IdleTimeout time.Duration `yaml:"idle_timeout"`
}

type SecurityConfig

type SecurityConfig struct {
	Secret     string        `yaml:"secret"`
	TokenTTL   time.Duration `yaml:"token_ttl"`
	BCryptCost int           `yaml:"bcrypt_cost"`
	Users      []UserConfig  `yaml:"users"`
}

type UserConfig

type UserConfig struct {
	Name     string   `yaml:"name"`
	Password string   `yaml:"password"`
	Scopes   []string `yaml:"scopes"`
}

Jump to

Keyboard shortcuts

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