config

package
v2.0.2-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttributeID          = attribute.Key("d7y.manager.id")
	AttributePreheatType = attribute.Key("d7y.manager.preheat.type")
	AttributePreheatURL  = attribute.Key("d7y.manager.preheat.url")
)
View Source
const (
	SpanPreheat          = "preheat"
	SpanGetLayers        = "get-layers"
	SpanAuthWithRegistry = "auth-with-registry"
)

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"`
	Metrics      *RestConfig     `yaml:"metrics" mapstructure:"metrics"`
}

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"`
	Migrate  bool   `yaml:"migrate" mapstructure:"migrate"`
}

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"`
	CacheDB   int    `yaml:"cacheDB" mapstructure:"cacheDB"`
	BrokerDB  int    `yaml:"brokerDB" mapstructure:"brokerDB"`
	BackendDB int    `yaml:"backendDB" mapstructure:"backendDB"`
}

type RestConfig

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

type ServerConfig

type ServerConfig struct {
	Name       string           `yaml:"name" mapstructure:"name"`
	LogDir     string           `yaml:"logDir" mapstructure:"logDir"`
	PublicPath string           `yaml:"publicPath" mapstructure:"publicPath"`
	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