Documentation
¶
Index ¶
- func DefaultYAML() []byte
- func ExpandEnv(s string) string
- func GenerateDefaultConfig(filename string, force bool) error
- func ParseMemorySize(size string) (int64, error)
- type AuthConfig
- type CacheConfig
- type ClusterConfig
- type Config
- func (c *Config) AuthTokens() []string
- func (c *Config) GetRESPAddress() string
- func (c *Config) GetRESTAddress() string
- func (c *Config) GetTCPAddress() string
- func (c *Config) IsFeatureEnabled(feature string) bool
- func (c *Config) RESTEnabled() bool
- func (c *Config) TCPEnabled() bool
- func (c *Config) Validate() error
- type ConnectionPoolConfig
- type DiscoveryConfig
- type FeaturesConfig
- type HealthConfig
- type LoggingConfig
- type MetricsConfig
- type MonitoringConfig
- type PerformanceConfig
- type PersistenceConfig
- type ProfilingConfig
- type RESPConfig
- type RESTConfig
- type RateLimitConfig
- type ReplicationConfig
- type SecurityConfig
- type ServerConfig
- type SnapshotConfig
- type TCPConfig
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultYAML ¶
func DefaultYAML() []byte
DefaultYAML returns the documented default configuration file.
func ExpandEnv ¶
ExpandEnv replaces ${VAR} and ${VAR:-default}. Unlike os.ExpandEnv it leaves bare $VAR alone, so values such as passwords containing '$' are not mangled.
func GenerateDefaultConfig ¶
GenerateDefaultConfig writes the default configuration to filename. It refuses to overwrite an existing file unless force is set.
func ParseMemorySize ¶
ParseMemorySize parses sizes such as "512MB", "1.5GB", "64kb", "100" or "0". Units are binary (1KB = 1024 bytes). An empty string means 0.
Types ¶
type AuthConfig ¶
type CacheConfig ¶
type CacheConfig struct {
MaxMemory string `yaml:"max_memory"`
MaxKeys int `yaml:"max_keys"`
DefaultTTL time.Duration `yaml:"default_ttl"`
MaxTTL time.Duration `yaml:"max_ttl"`
CleanupInterval time.Duration `yaml:"cleanup_interval"`
EvictionPolicy string `yaml:"eviction_policy"`
EvictionThreshold float64 `yaml:"eviction_threshold"`
}
type ClusterConfig ¶
type ClusterConfig struct {
Enabled bool `yaml:"enabled"`
NodeID string `yaml:"node_id"`
Replication ReplicationConfig `yaml:"replication"`
Discovery DiscoveryConfig `yaml:"discovery"`
}
type Config ¶
type Config struct {
Server ServerConfig `yaml:"server"`
Cache CacheConfig `yaml:"cache"`
Persistence PersistenceConfig `yaml:"persistence"`
Cluster ClusterConfig `yaml:"cluster"`
Security SecurityConfig `yaml:"security"`
Logging LoggingConfig `yaml:"logging"`
Monitoring MonitoringConfig `yaml:"monitoring"`
Performance PerformanceConfig `yaml:"performance"`
Features FeaturesConfig `yaml:"features"`
}
var GlobalConfig *Config
func Default ¶
func Default() *Config
Default returns the built-in configuration used for any setting missing from the config file.
func LoadConfig ¶
LoadConfig reads filename over the defaults. A missing file yields the defaults. ${VAR} and ${VAR:-default} references are expanded from the environment before parsing, so secrets can be injected without editing the file.
func (*Config) AuthTokens ¶
AuthTokens returns the configured tokens, ignoring empty entries (which appear when a ${VAR} reference is unset).
func (*Config) GetRESPAddress ¶
func (*Config) GetRESTAddress ¶
func (*Config) GetTCPAddress ¶
func (*Config) IsFeatureEnabled ¶
func (*Config) RESTEnabled ¶
RESTEnabled reports whether the HTTP API runs.
func (*Config) TCPEnabled ¶
TCPEnabled reports whether the TCP (text + RESP) listener runs.
type ConnectionPoolConfig ¶
type DiscoveryConfig ¶
type FeaturesConfig ¶
type HealthConfig ¶
type LoggingConfig ¶
type MetricsConfig ¶
type MonitoringConfig ¶
type MonitoringConfig struct {
Metrics MetricsConfig `yaml:"metrics"`
Health HealthConfig `yaml:"health"`
Profiling ProfilingConfig `yaml:"profiling"`
}
type PerformanceConfig ¶
type PerformanceConfig struct {
MaxGoroutines int `yaml:"max_goroutines"`
ReadBufferSize string `yaml:"read_buffer_size"`
WriteBufferSize string `yaml:"write_buffer_size"`
GCPercent int `yaml:"gc_percent"`
ConnectionPool ConnectionPoolConfig `yaml:"connection_pool"`
}
type PersistenceConfig ¶
type PersistenceConfig struct {
Enabled bool `yaml:"enabled"`
File string `yaml:"file"`
Interval time.Duration `yaml:"interval"`
Compression bool `yaml:"compression"`
BackupCount int `yaml:"backup_count"`
Snapshot SnapshotConfig `yaml:"snapshot"`
// Cleanup starts only when the total number of backup files
// exceeds this value.
// Old backups are deleted until BackupCount files remain.
CleanupWhenExceeds int `yaml:"cleanup_when_exceeds"`
}
type ProfilingConfig ¶
type RESPConfig ¶
type RESPConfig struct {
Enabled *bool `yaml:"enabled"`
Host string `yaml:"host"`
Port int `yaml:"port"`
}
RESPConfig is the dedicated Redis protocol listener (redis-cli, go-redis, ioredis, redis-py...). The TCP listener also understands RESP; this one replies to inline commands in RESP as well, exactly like Redis.
func (RESPConfig) IsEnabled ¶
func (r RESPConfig) IsEnabled() bool
IsEnabled reports whether the RESP listener should run (default true).
type RESTConfig ¶
type RateLimitConfig ¶
type ReplicationConfig ¶
type SecurityConfig ¶
type SecurityConfig struct {
Auth AuthConfig `yaml:"auth"`
TLS TLSConfig `yaml:"tls"`
RateLimit RateLimitConfig `yaml:"rate_limit"`
}
type ServerConfig ¶
type ServerConfig struct {
Mode string `yaml:"mode"`
SwaggerUI bool `yaml:"swaggerui,omitempty"`
TCP TCPConfig `yaml:"tcp"`
RESP RESPConfig `yaml:"resp"`
REST RESTConfig `yaml:"rest"`
}