config

package
v2.0.4-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 7 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 cache configuration
	Redis *RedisCacheConfig `yaml:"redis" mapstructure:"redis"`

	// Local cache configuration
	Local *LocalCacheConfig `yaml:"local" mapstructure:"local"`
}

type Config

type Config struct {
	// Base options
	base.Options `yaml:",inline" mapstructure:",squash"`

	// Server configuration
	Server *ServerConfig `yaml:"server" mapstructure:"server"`

	// Database configuration
	Database *DatabaseConfig `yaml:"database" mapstructure:"database"`

	// Cache configuration
	Cache *CacheConfig `yaml:"cache" mapstructure:"cache"`

	// ObjectStorage configuration
	ObjectStorage *ObjectStorageConfig `yaml:"objectStorage" mapstructure:"objectStorage"`

	// Metrics configuration
	Metrics *MetricsConfig `yaml:"metrics" mapstructure:"metrics"`
}

func New

func New() *Config

New config instance

func (*Config) Validate

func (cfg *Config) Validate() error

Validate config values

type DatabaseConfig

type DatabaseConfig struct {
	// Mysql configuration
	Mysql *MysqlConfig `yaml:"mysql" mapstructure:"mysql"`

	// Redis configuration
	Redis *RedisConfig `yaml:"redis" mapstructure:"redis"`
}

type LocalCacheConfig

type LocalCacheConfig struct {
	// Size of LFU cache
	Size int `yaml:"size" mapstructure:"size"`

	// Cache TTL
	TTL time.Duration `yaml:"ttl" mapstructure:"ttl"`
}

type MetricsConfig added in v2.0.4

type MetricsConfig struct {
	// Enable metrics service.
	Enable bool `yaml:"enable" mapstructure:"enable"`

	// Metrics service address.
	Addr string `yaml:"addr" mapstructure:"addr"`

	// Enable peer gauge metrics.
	EnablePeerGauge bool `yaml:"enablePeerGauge" mapstructure:"enablePeerGauge"`
}

type MysqlConfig

type MysqlConfig struct {
	// Server username
	User string `yaml:"user" mapstructure:"user"`

	// Server password
	Password string `yaml:"password" mapstructure:"password"`

	// Server host
	Host string `yaml:"host" mapstructure:"host"`

	// Server port
	Port int `yaml:"port" mapstructure:"port"`

	// Server DB name
	DBName string `yaml:"dbname" mapstructure:"dbname"`

	// Enable migration
	Migrate bool `yaml:"migrate" mapstructure:"migrate"`

	// TLS configuration
	TLS *TLSConfig `yaml:"tls" mapstructure:"tls"`
}

type ObjectStorageConfig added in v2.0.4

type ObjectStorageConfig struct {
	// Enable object storage.
	Enable bool `yaml:"enable" mapstructure:"enable"`

	// Object storage name of type, it can be s3 or oss.
	Name string `mapstructure:"name" yaml:"name"`

	// Storage region.
	Region string `mapstructure:"region" yaml:"region"`

	// Datacenter endpoint.
	Endpoint string `mapstructure:"endpoint" yaml:"endpoint"`

	// Access key ID.
	AccessKey string `mapstructure:"accessKey" yaml:"accessKey"`

	// Access key secret.
	SecretKey string `mapstructure:"secretKey" yaml:"secretKey"`
}

type RedisCacheConfig

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

type RedisConfig

type RedisConfig struct {
	// Server host
	Host string `yaml:"host" mapstructure:"host"`

	// Server port
	Port int `yaml:"port" mapstructure:"port"`

	// Server password
	Password string `yaml:"password" mapstructure:"password"`

	// Server cache DB name
	CacheDB int `yaml:"cacheDB" mapstructure:"cacheDB"`

	// Server broker DB name
	BrokerDB int `yaml:"brokerDB" mapstructure:"brokerDB"`

	// Server backend DB name
	BackendDB int `yaml:"backendDB" mapstructure:"backendDB"`
}

type RestConfig

type RestConfig struct {
	// REST server address
	Addr string `yaml:"addr" mapstructure:"addr"`
}

type ServerConfig

type ServerConfig struct {
	// Server name
	Name string `yaml:"name" mapstructure:"name"`

	// Server log directory
	LogDir string `yaml:"logDir" mapstructure:"logDir"`

	// Console resource path
	PublicPath string `yaml:"publicPath" mapstructure:"publicPath"`

	// GRPC server configuration
	GRPC *TCPListenConfig `yaml:"grpc" mapstructure:"grpc"`

	// REST server configuration
	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
}

type TLSConfig added in v2.0.2

type TLSConfig struct {
	// Client certificate file path
	Cert string `yaml:"cert" mapstructure:"cert"`

	// Client key file path
	Key string `yaml:"key" mapstructure:"key"`

	// CA file path
	CA string `yaml:"ca" mapstructure:"ca"`

	// InsecureSkipVerify controls whether a client verifies the
	// server's certificate chain and host name.
	InsecureSkipVerify bool `yaml:"insecureSkipVerify" mapstructure:"insecureSkipVerify"`
}

func (*TLSConfig) Client added in v2.0.2

func (t *TLSConfig) Client() (*tls.Config, error)

Generate client tls config

Jump to

Keyboard shortcuts

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