config

package
v0.1.0-beta-3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	Redis *RedisCacheConfig `yaml:"redis" mapstructure:"redis"`
	Local *LocalCacheConfig `yaml:"local" mapstructure:"local"`
}

type Config

type Config struct {
	base.Options `yaml:",inline" mapstructure:",squash"`
	Server       *ServerConfig   `yaml:"server" mapstructure:"server"`
	Database     *DatabaseConfig `yaml:"database" mapstructure:"database"`
	Cache        *CacheConfig    `yaml:"cache" mapstructure:"cache"`
}

func New

func New() *Config

func (*Config) Validate

func (cfg *Config) Validate() error

type DatabaseConfig

type DatabaseConfig struct {
	Mysql *MysqlConfig `yaml:"mysql" mapstructure:"mysql"`
	Redis *RedisConfig `yaml:"redis" mapstructure:"redis"`
}

type LocalCacheConfig

type LocalCacheConfig struct {
	Size int           `yaml:"size" mapstructure:"size"`
	TTL  time.Duration `yaml:"ttl" mapstructure:"ttl"`
}

type MysqlConfig

type MysqlConfig struct {
	User     string `yaml:"user" mapstructure:"user"`
	Password string `yaml:"password" mapstructure:"password"`
	Host     string `yaml:"host" mapstructure:"host"`
	Port     int    `yaml:"port" mapstructure:"port"`
	DBName   string `yaml:"dbname" mapstructure:"dbname"`
}

type RedisCacheConfig

type RedisCacheConfig struct {
	TTL time.Duration `yaml:"ttl" mapstructure:"ttl"`
}

type RedisConfig

type RedisConfig struct {
	Host     string `yaml:"host" mapstructure:"host"`
	Port     int    `yaml:"port" mapstructure:"port"`
	Password string `yaml:"password" mapstructure:"password"`
	DB       int    `yaml:"db" mapstructure:"db"`
}

type RestConfig

type RestConfig struct {
	Addr string `yaml:"addr" mapstructure:"addr"`
}

type ServerConfig

type ServerConfig struct {
	GRPC *TCPListenConfig `yaml:"grpc" mapstructure:"grpc"`
	REST *RestConfig      `yaml:"rest" mapstructure:"rest"`
}

type TCPListenConfig

type TCPListenConfig struct {
	// Listen stands listen interface, like: 0.0.0.0, 192.168.0.1
	Listen string `mapstructure:"listen" yaml:"listen"`

	// PortRange stands listen port
	PortRange TCPListenPortRange `yaml:"port" mapstructure:"port"`
}

type TCPListenPortRange

type TCPListenPortRange struct {
	Start int
	End   int
}

Jump to

Keyboard shortcuts

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