config

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownSourceType = errors.New("unknown type")

ErrUnknownSourceType when source type not string-path or io.Reader

Functions

func Load

func Load(src, config interface{}) error

Load config from source (like io.Reader / string path) and validate it (https://github.com/go-playground/validator)

Types

type Database added in v1.6.6

type Database struct {
	Address  string `yaml:"address" validate:"required"`
	Database string `yaml:"database" validate:"required"`
	User     string `yaml:"user" validate:"required"`
	Password string `yaml:"password"`
}

Database base configuration:

func (Database) Connect added in v1.6.6

func (d Database) Connect() (*pg.DB, error)

Connect to PostgreSQL and check connection:

type Mail added in v1.11.1

type Mail struct {
	APIKey            string        `yaml:"api_key" validate:"required"`
	Recipients        []string      `yaml:"recipients" validate:"required,min=1"`
	FromEmail         string        `yaml:"from_email" validate:"required,email"`
	FromName          string        `yaml:"from_name" validate:"required"`
	SendUniqTimeout   time.Duration `yaml:"send_uniq_timeout" validate:"gte=1"`
	RetryErrorTimeout time.Duration `yaml:"retry_error_timeout" validate:"gte=1"`
}

Mail default configuration

func (Mail) Connect added in v1.11.1

func (g Mail) Connect(log mail.Logger) (mail.Mailer, error)

Connect to Mail

type Proxy added in v1.6.6

type Proxy string

Proxy default configuration

func (Proxy) Apply added in v1.6.6

func (p Proxy) Apply(hc *http.Client) error

Apply proxy to http.Client

func (Proxy) String added in v1.6.6

func (p Proxy) String() string

String return proxy-url

type Redis added in v1.6.6

type Redis struct {
	Address     string        `yaml:"address" validate:"required"`
	Database    int           `yaml:"database"`
	Password    string        `yaml:"password"`
	PoolSize    int           `yaml:"pool_size" validate:"gte=0"`
	PoolTimeout time.Duration `yaml:"pool_timeout" validate:"gte=0"`
}

Redis default configuration

func (Redis) Connect added in v1.6.6

func (r Redis) Connect() (*redis.Client, error)

Connect to Redis and check connection:

Jump to

Keyboard shortcuts

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