xconfig

package
v0.0.0-...-94fc6d2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AppDir  string
	Service string
	Env     string

	RedisCache *RedisRing `yaml:"redis_cache"`
	PGMain     *Postgres  `yaml:"pg_main"`

	Uptrace struct {
		DSN string `yaml:"dsn"`
	} `yaml:"uptrace"`

	SecretKey string `yaml:"secret_key"`
}

func LoadConfig

func LoadConfig(service string) (*Config, error)

func LoadConfigEnv

func LoadConfigEnv(service, env string) (*Config, error)

type Postgres

type Postgres struct {
	Addr     string
	Database string
	User     string
	Password string
	SSL      bool

	MaxRetries int `yaml:"max_retries"`

	DialTimeout  time.Duration `yaml:"dial_timeout"`
	ReadTimeout  time.Duration `yaml:"read_timeout"`
	WriteTimeout time.Duration `yaml:"write_timeout"`

	PoolSize     int           `yaml:"pool_size"`
	MinIdleConns int           `yaml:"min_idle_conns"`
	MaxConnAge   time.Duration `yaml:"max_conn_age"`
	PoolTimeout  time.Duration `yaml:"pool_timeout"`
	IdleTimeout  time.Duration `yaml:"idle_timeout"`

	ConnectionPoolPort string `yaml:"connection_pool_port"`
}

func (*Postgres) Options

func (cfg *Postgres) Options() *pg.Options

type RedisRing

type RedisRing struct {
	Addrs    map[string]string
	Password string
	DB       int

	MaxRetries int `yaml:"max_retries"`

	PoolSize    int           `yaml:"pool_size"`
	PoolTimeout time.Duration `yaml:"pool_timeout"`
	IdleTimeout time.Duration `yaml:"idle_timeout"`

	DialTimeout  time.Duration `yaml:"dial_timeout"`
	ReadTimeout  time.Duration `yaml:"read_timeout"`
	WriteTimeout time.Duration `yaml:"write_timeout"`
}

func (*RedisRing) Options

func (cfg *RedisRing) Options() *redis.RingOptions

Jump to

Keyboard shortcuts

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