Documentation
¶
Index ¶
- Constants
- Variables
- func GetAPISectionSpecifier(pluginName string) string
- func GetCoreSectionSpecifier(key string) string
- func GetProtoSectionSpecifier(pluginName string) string
- func GetServiceSectionSpecifier(pluginName string, serviceName string) string
- type APIConfig
- type AccountConfig
- type CacheConfig
- type CacheMode
- type ClusterConfig
- type Config
- type ConfigChangeCallback
- type ConfigPropertyUpdateCategory
- type ConfigUpdate
- type CoreConfig
- type CronConfig
- type DatabaseConfig
- type Defaults
- type Etcd
- type EtcdConfig
- type FieldProcessor
- type LogConfig
- type MailConfig
- type Manager
- type ManagerDefault
- func (m *ManagerDefault) All() map[string]any
- func (m *ManagerDefault) Config() *Config
- func (m *ManagerDefault) ConfigDir() string
- func (m *ManagerDefault) ConfigFile() string
- func (m *ManagerDefault) ConfigureAPI(pluginName string, cfg APIConfig) error
- func (m *ManagerDefault) ConfigureProtocol(pluginName string, cfg ProtocolConfig) error
- func (m *ManagerDefault) ConfigureService(pluginName string, serviceName string, cfg ServiceConfig) error
- func (m *ManagerDefault) Exists(key string) bool
- func (m *ManagerDefault) FieldProcessor(obj any, prefix string, processors ...FieldProcessor) error
- func (m *ManagerDefault) Flags(key string) []string
- func (m *ManagerDefault) Get(key string) any
- func (m *ManagerDefault) GetAPI(pluginName string) APIConfig
- func (m *ManagerDefault) GetPlugin(pluginName string) *PluginEntity
- func (m *ManagerDefault) GetProtocol(pluginName string) ProtocolConfig
- func (m *ManagerDefault) GetService(serviceName string) ServiceConfig
- func (m *ManagerDefault) Init() error
- func (m *ManagerDefault) IsEditable(key string) bool
- func (m *ManagerDefault) RegisterConfigChangeCallback(callback ConfigChangeCallback)
- func (m *ManagerDefault) Save() error
- func (m *ManagerDefault) SetLogger(logger *zap.Logger)
- func (m *ManagerDefault) Update(key string, value any) error
- type MemoryConfig
- type PluginEntity
- type ProtocolConfig
- type Reconfigurable
- type RedisConfig
- type S3Config
- type Scope
- type ServiceConfig
- type SiaConfig
- type StorageConfig
- type SyncConfig
- type TusConfig
- type Validator
Constants ¶
View Source
const ( CLUSTER_CONFIG_KEY = "config" FLAG_SYNC = "sync" CONFIG_EXTENSION = ".yaml" CoreConfigFile = "core" + CONFIG_EXTENSION SectionConfigFile = "default" + CONFIG_EXTENSION PluginsDir = "plugins.d" ProtoDir = "proto.d" ServiceDir = "service.d" APIDir = "api.d" )
Constants
Variables ¶
View Source
var (
ErrInvalidServiceConfig = errors.New("service config must be of type config.ServiceConfig")
)
Functions ¶
func GetAPISectionSpecifier ¶ added in v0.2.0
func GetCoreSectionSpecifier ¶ added in v0.2.0
func GetProtoSectionSpecifier ¶ added in v0.2.0
func GetServiceSectionSpecifier ¶ added in v0.2.0
Types ¶
type AccountConfig ¶ added in v0.2.0
type AccountConfig struct {
DeletionGracePeriod uint `config:"deletion_grace_period"`
}
func (AccountConfig) Defaults ¶ added in v0.2.0
func (a AccountConfig) Defaults() map[string]any
type CacheConfig ¶
type CacheConfig struct { Mode CacheMode `config:"mode"` Options interface{} `config:"options"` }
func (CacheConfig) Defaults ¶ added in v0.2.0
func (c CacheConfig) Defaults() map[string]any
func (CacheConfig) Validate ¶ added in v0.2.0
func (c CacheConfig) Validate() error
type ClusterConfig ¶
type ClusterConfig struct { Enabled bool `config:"enabled"` Redis *RedisConfig `config:"redis"` Etcd *EtcdConfig `config:"etcd"` }
func (ClusterConfig) RedisEnabled ¶ added in v0.2.0
func (c ClusterConfig) RedisEnabled() bool
func (ClusterConfig) Validate ¶ added in v0.2.0
func (c ClusterConfig) Validate() error
type Config ¶
type Config struct { Core CoreConfig `config:"core"` Plugin map[string]PluginEntity `config:"plugin"` }
type ConfigChangeCallback ¶ added in v0.2.0
type ConfigPropertyUpdateCategory ¶ added in v0.2.0
type ConfigPropertyUpdateCategory string
const ( CONFIG_PROPERTY_UPDATE_EVENT_CATEGORY_CORE ConfigPropertyUpdateCategory = "core" CONFIG_PROPERTY_UPDATE_EVENT_CATEGORY_PROTOCOL ConfigPropertyUpdateCategory = "protocol" CONFIG_PROPERTY_UPDATE_EVENT_CATEGORY_API ConfigPropertyUpdateCategory = "api" CONFIG_PROPERTY_UPDATE_EVENT_CATEGORY_SERVICE ConfigPropertyUpdateCategory = "service" )
type ConfigUpdate ¶ added in v0.2.0
type CoreConfig ¶
type CoreConfig struct { DB DatabaseConfig `config:"db"` Domain string `config:"domain"` PortalName string `config:"portal_name"` ExternalPort uint `config:"external_port"` Identity types.Identity `config:"identity"` Log LogConfig `config:"log"` Port uint `config:"port"` PostUploadLimit uint64 `config:"post_upload_limit"` Storage StorageConfig `config:"storage"` Mail MailConfig `config:"mail"` Clustered *ClusterConfig `config:"clustered"` NodeID types.UUID `config:"node_id"` Cron CronConfig `config:"cron"` Account AccountConfig `config:"account"` }
func (CoreConfig) ClusterEnabled ¶
func (c CoreConfig) ClusterEnabled() bool
func (CoreConfig) Defaults ¶
func (c CoreConfig) Defaults() map[string]any
func (CoreConfig) Validate ¶
func (c CoreConfig) Validate() error
type CronConfig ¶ added in v0.2.0
func (CronConfig) Defaults ¶ added in v0.2.0
func (c CronConfig) Defaults() map[string]any
type DatabaseConfig ¶
type DatabaseConfig struct { Type string `config:"type"` File string `config:"file"` Charset string `config:"charset"` Host string `config:"host"` Name string `config:"name"` Password string `config:"password"` Port int `config:"port"` Username string `config:"username"` Cache *CacheConfig `config:"cache"` }
func (DatabaseConfig) CacheEnabled ¶ added in v0.2.0
func (d DatabaseConfig) CacheEnabled() bool
func (DatabaseConfig) Defaults ¶
func (d DatabaseConfig) Defaults() map[string]any
func (DatabaseConfig) Validate ¶
func (d DatabaseConfig) Validate() error
type Etcd ¶ added in v0.2.0
type Etcd struct {
// contains filtered or unexported fields
}
func NewEtcdProvider ¶ added in v0.2.0
Provider returns a provider that takes etcd config.
type EtcdConfig ¶
type EtcdConfig struct { Endpoints []string `config:"endpoints"` DialTimeout int `config:"dial_timeout"` // contains filtered or unexported fields }
func (*EtcdConfig) Defaults ¶
func (r *EtcdConfig) Defaults() map[string]interface{}
func (*EtcdConfig) Validate ¶
func (r *EtcdConfig) Validate() error
type FieldProcessor ¶ added in v0.2.0
type FieldProcessor func(parent *reflect.StructField, field reflect.StructField, value reflect.Value, prefix string) error
type MailConfig ¶
type MailConfig struct { Host string `config:"host"` Port int `config:"port"` SSL bool `config:"ssl"` AuthType string `config:"auth_type"` Username string `config:"username"` Password string `config:"password"` From string `config:"from"` }
func (MailConfig) Defaults ¶
func (c MailConfig) Defaults() map[string]interface{}
func (MailConfig) Validate ¶
func (m MailConfig) Validate() error
type Manager ¶
type Manager interface { Init() error SetLogger(logger *zap.Logger) RegisterConfigChangeCallback(callback ConfigChangeCallback) FieldProcessor(obj any, prefix string, processors ...FieldProcessor) error ConfigureProtocol(pluginName string, cfg ProtocolConfig) error ConfigureAPI(pluginName string, cfg APIConfig) error ConfigureService(pluginName string, serviceName string, cfg ServiceConfig) error GetPlugin(pluginName string) *PluginEntity GetService(serviceName string) ServiceConfig GetProtocol(pluginName string) ProtocolConfig GetAPI(pluginName string) APIConfig Config() *Config Save() error ConfigFile() string ConfigDir() string Update(key string, value any) error Exists(key string) bool Get(key string) any All() map[string]any IsEditable(key string) bool Flags(key string) []string }
type ManagerDefault ¶
type ManagerDefault struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() (*ManagerDefault, error)
func (*ManagerDefault) All ¶ added in v0.2.0
func (m *ManagerDefault) All() map[string]any
func (*ManagerDefault) Config ¶
func (m *ManagerDefault) Config() *Config
func (*ManagerDefault) ConfigDir ¶
func (m *ManagerDefault) ConfigDir() string
func (*ManagerDefault) ConfigFile ¶
func (m *ManagerDefault) ConfigFile() string
func (*ManagerDefault) ConfigureAPI ¶
func (m *ManagerDefault) ConfigureAPI(pluginName string, cfg APIConfig) error
func (*ManagerDefault) ConfigureProtocol ¶
func (m *ManagerDefault) ConfigureProtocol(pluginName string, cfg ProtocolConfig) error
func (*ManagerDefault) ConfigureService ¶
func (m *ManagerDefault) ConfigureService(pluginName string, serviceName string, cfg ServiceConfig) error
func (*ManagerDefault) Exists ¶ added in v0.2.0
func (m *ManagerDefault) Exists(key string) bool
func (*ManagerDefault) FieldProcessor ¶ added in v0.2.0
func (m *ManagerDefault) FieldProcessor(obj any, prefix string, processors ...FieldProcessor) error
func (*ManagerDefault) Flags ¶ added in v0.2.0
func (m *ManagerDefault) Flags(key string) []string
func (*ManagerDefault) Get ¶ added in v0.2.0
func (m *ManagerDefault) Get(key string) any
func (*ManagerDefault) GetAPI ¶
func (m *ManagerDefault) GetAPI(pluginName string) APIConfig
func (*ManagerDefault) GetPlugin ¶
func (m *ManagerDefault) GetPlugin(pluginName string) *PluginEntity
func (*ManagerDefault) GetProtocol ¶ added in v0.1.1
func (m *ManagerDefault) GetProtocol(pluginName string) ProtocolConfig
func (*ManagerDefault) GetService ¶
func (m *ManagerDefault) GetService(serviceName string) ServiceConfig
func (*ManagerDefault) Init ¶
func (m *ManagerDefault) Init() error
func (*ManagerDefault) IsEditable ¶ added in v0.2.0
func (m *ManagerDefault) IsEditable(key string) bool
func (*ManagerDefault) RegisterConfigChangeCallback ¶ added in v0.2.0
func (m *ManagerDefault) RegisterConfigChangeCallback(callback ConfigChangeCallback)
func (*ManagerDefault) Save ¶
func (m *ManagerDefault) Save() error
func (*ManagerDefault) SetLogger ¶ added in v0.2.0
func (m *ManagerDefault) SetLogger(logger *zap.Logger)
type MemoryConfig ¶
type MemoryConfig struct { }
type PluginEntity ¶
type PluginEntity struct { Protocol ProtocolConfig `config:"protocol"` API APIConfig `config:"api"` Service map[string]ServiceConfig `config:"service"` }
type ProtocolConfig ¶
type ProtocolConfig interface { Defaults }
type Reconfigurable ¶ added in v0.2.0
type RedisConfig ¶
type RedisConfig struct { Address string `config:"address"` Password string `config:"password"` DB int `config:"db"` // contains filtered or unexported fields }
func (*RedisConfig) Client ¶
func (r *RedisConfig) Client() (*redis.Client, error)
func (*RedisConfig) Defaults ¶
func (r *RedisConfig) Defaults() map[string]interface{}
func (*RedisConfig) Validate ¶
func (r *RedisConfig) Validate() error
type S3Config ¶
type Scope ¶ added in v0.2.0
type Scope struct {
// contains filtered or unexported fields
}
func NewScope ¶ added in v0.2.0
func NewScope(category ConfigPropertyUpdateCategory, entity, subEntity, property string) Scope
func NewScopeFromKey ¶ added in v0.2.0
func (Scope) Category ¶ added in v0.2.0
func (s Scope) Category() ConfigPropertyUpdateCategory
type ServiceConfig ¶
type ServiceConfig interface { Defaults }
type SiaConfig ¶
type StorageConfig ¶
type SyncConfig ¶
type SyncConfig struct {
Enabled bool `config:"enabled"`
}
func (SyncConfig) Defaults ¶
func (s SyncConfig) Defaults() map[string]any
Source Files
¶
Click to show internal directories.
Click to hide internal directories.