config

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxBackupSizeBytes = 10 * 1024 * 1024 // 10MB

Variables

This section is empty.

Functions

func ParseConfiguration

func ParseConfiguration()

func SanitizeRedisURL added in v1.1.7

func SanitizeRedisURL(rawURL string) string

SanitizeRedisURL strips embedded credentials (userinfo) from a Redis URL so it can be safely published as a target attribute or used as a metric label. Scheme, host, port and path (database) are preserved. The full credentials remain in the endpoint configuration and are used for the actual connection.

func ValidateConfiguration

func ValidateConfiguration()

Types

type RedisEndpoint

type RedisEndpoint struct {
	URL                string `json:"url"`                          // Redis connection URL (redis:// or rediss://)
	Password           string `json:"password,omitempty"`           // Redis password
	Username           string `json:"username,omitempty"`           // Redis username (Redis 6+ ACL)
	DB                 int    `json:"db,omitempty"`                 // Database number (default 0, ignored in cluster mode)
	InsecureSkipVerify bool   `json:"insecureSkipVerify,omitempty"` // Skip TLS verification
	Name               string `json:"name,omitempty"`               // Friendly name for this endpoint

	// Cluster support
	ClusterMode        string `json:"clusterMode,omitempty"`        // "auto" (default), "standalone", or "cluster"
	MaxBackupSizeBytes int64  `json:"maxBackupSizeBytes,omitempty"` // Max total backup size for cache expiration (default 10MB)
}

func GetEndpointByURL

func GetEndpointByURL(rawURL string) *RedisEndpoint

GetEndpointByURL resolves the configured endpoint for a (possibly credential-stripped) URL. Both sides are sanitized before comparison so a published, credential-free target URL still resolves to its endpoint configuration.

func (*RedisEndpoint) GetMaxBackupSizeBytes added in v1.1.0

func (e *RedisEndpoint) GetMaxBackupSizeBytes() int64

type Specification

type Specification struct {
	// JSON array of Redis endpoints
	EndpointsJSON string `json:"endpointsJson" split_words:"true" required:"true"`
	Endpoints     []RedisEndpoint

	// Discovery intervals in seconds
	DiscoveryIntervalInstanceSeconds int `json:"discoveryIntervalInstanceSeconds" split_words:"true" default:"30"`
	DiscoveryIntervalDatabaseSeconds int `json:"discoveryIntervalDatabaseSeconds" split_words:"true" default:"60"`

	// Attribute exclusion patterns
	DiscoveryAttributesExcludesInstances []string `json:"discoveryAttributesExcludesInstances" split_words:"true"`
	DiscoveryAttributesExcludesDatabases []string `json:"discoveryAttributesExcludesDatabases" split_words:"true"`
}
var (
	Config Specification
)

Jump to

Keyboard shortcuts

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