config

package
v0.0.0-...-3f615ee Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultNormalRateLimitMaxRequests  = 100
	DefaultSpecialRateLimitMaxRequests = 50
	DefaultSpecialRateLimitedPath      = "/rainbow/search"
	DefaultUserRateLimitCap            = 1000
	DefaultUserRateLimitQuantum        = 10
	DefaultUserRateLimitCapacity       = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentOption

type AgentOption struct {
	Name       string `yaml:"name"`
	DataDir    string `yaml:"data_dir"`
	RetainDays int    `yaml:"retain_days"`
}

type Auth

type Auth struct {
	AccessKey string `yaml:"access_key"`
	SecretKey string `yaml:"secret_key"`
}

type Config

type Config struct {
	Default DefaultOption `yaml:"default"`

	Mysql MysqlOptions `yaml:"mysql"`
	Redis RedisOption  `yaml:"redis"`

	Kubernetes KubernetesOption `yaml:"kubernetes"`
	Images     []Image          `yaml:"images"`

	Server   ServerOption   `yaml:"server"`
	Rainbowd RainbowdOption `yaml:"rainbowd"`

	Rocketmq RocketmqOption `yaml:"rocketmq"`

	Plugin   PluginOption `yaml:"plugin"`
	Registry Registry     `yaml:"registry"`

	Agent AgentOption `yaml:"agent"`

	RateLimit RateLimitOption `yaml:"rate_limit"`
}

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults 设置配置的默认值

type Credential

type Credential struct {
	AccessKey string `yaml:"access_key"`
	SecretKey string `yaml:"secret_key"`
}

type DefaultOption

type DefaultOption struct {
	Listen int    `yaml:"listen"`
	Mode   string `yaml:"mode"` // debug 和 release 模式

	PushKubernetes bool `yaml:"push_kubernetes"`
	PushImages     bool `yaml:"push_images"`

	Time int64 `yaml:"time"`
}

type Harbor

type Harbor struct {
	URL       string `yaml:"url"`
	Namespace string `yaml:"namespace"`
	Username  string `yaml:"username"`
	Password  string `yaml:"password"`
}

type Image

type Image struct {
	Name string   `yaml:"name"`
	Id   int64    `yaml:"id"`
	Path string   `yaml:"path"`
	Tags []string `yaml:"tags"`
}

func (Image) GetId

func (i Image) GetId() int64

func (Image) GetMap

func (i Image) GetMap(repo, ns string) map[string]string

func (Image) GetPath

func (i Image) GetPath() string

type KubernetesOption

type KubernetesOption struct {
	Version string `yaml:"version"`
}

type MysqlOptions

type MysqlOptions struct {
	Host     string `yaml:"host"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Port     int    `yaml:"port"`
	Name     string `yaml:"name"`
}

type NormalRateLimit

type NormalRateLimit struct {
	MaxRequests int `yaml:"max_requests"`
}

type PluginOption

type PluginOption struct {
	Callback   string `yaml:"callback"`
	TaskId     int64  `yaml:"task_id"`
	RegistryId int64  `yaml:"registry_id"`
	Synced     bool   `yaml:"synced"`
	Driver     string `yaml:"driver"`
	Arch       string `yaml:"arch"`
}

type PluginTemplateConfig

type PluginTemplateConfig struct {
	Default    DefaultOption    `yaml:"default"`
	Kubernetes KubernetesOption `yaml:"kubernetes"`
	Plugin     PluginOption     `yaml:"plugin"`
	Registry   Registry         `yaml:"registry"`
	Images     []Image          `yaml:"images"`
}

type RainbowdOption

type RainbowdOption struct {
	Name        string `yaml:"name"`
	TemplateDir string `yaml:"template_dir"`
	DataDir     string `yaml:"data_dir"`
	AgentImage  string `yaml:"agent_image"`
}

func (*RainbowdOption) SetDefault

func (r *RainbowdOption) SetDefault()

type RateLimitOption

type RateLimitOption struct {
	NormalRateLimit  NormalRateLimit  `yaml:"normal_rate_limit"`
	SpecialRateLimit SpecialRateLimit `yaml:"special_rate_limit"`
	UserRateLimit    UserRateLimit    `yaml:"user_rate_limit"`
}

type RedisOption

type RedisOption struct {
	Addr     string `yaml:"addr"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Db       int    `yaml:"db"`
}

type Registry

type Registry struct {
	Repository string `yaml:"repository"`
	Namespace  string `yaml:"namespace"`
	Username   string `yaml:"username"`
	Password   string `yaml:"password"`
}

type RocketmqOption

type RocketmqOption struct {
	NameServers []string   `yaml:"name_servers"`
	GroupName   string     `yaml:"group_name"`
	Topic       string     `yaml:"topic"`
	Credential  Credential `yaml:"credential"`
}

type ServerOption

type ServerOption struct {
	Auth   Auth   `yaml:"auth"`
	Harbor Harbor `yaml:"harbor"`
}

type SpecialRateLimit

type SpecialRateLimit struct {
	RateLimitedPath []string `yaml:"rate_limited_path"`
	MaxRequests     int      `yaml:"max_requests"`
}

type UserRateLimit

type UserRateLimit struct {
	Cap      int `yaml:"cap"`
	Quantum  int `yaml:"quantum"`
	Capacity int `yaml:"capacity"`
}

Jump to

Keyboard shortcuts

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