retrieverconf

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package retrieverconf defines the configuration of the retrievers and their serializable options.

Index

Constants

View Source
const (
	// DefaultTimeout is the timeout of a retriever that does not set one.
	DefaultTimeout = 10 * time.Second
	// DefaultHTTPMethod is the method of the HTTP retriever that does not set one.
	DefaultHTTPMethod = http.MethodGet
	// DefaultGitBranch is the branch of the git retrievers that do not set one.
	DefaultGitBranch = "main"
)

The defaults of the retriever configuration.

Variables

This section is empty.

Functions

This section is empty.

Types

type RetrieverConf

type RetrieverConf struct {
	HTTPHeaders map[string][]string `mapstructure:"headers"`
	// RedisOptions is the serializable redis configuration that can be used in JSON/YAML files
	RedisOptions *SerializableRedisOptions `mapstructure:"redisOptions"`
	// Columns is used by
	// - the postgresql retriever (it allows to use custom column names)
	Columns                 map[string]string `mapstructure:"columns"`
	Database                string            `mapstructure:"database"`
	ConfigMap               string            `mapstructure:"configmap"`
	URL                     string            `mapstructure:"url"`
	GitHubAppPrivateKeyFile string            `mapstructure:"githubAppPrivateKeyFile"`
	HTTPMethod              string            `mapstructure:"method"`
	HTTPBody                string            `mapstructure:"body"`
	Path                    string            `mapstructure:"path"`
	HTTPClientCertPath      string            `mapstructure:"clientCertPath"`
	HTTPClientKeyPath       string            `mapstructure:"clientKeyPath"`
	HTTPCACertPath          string            `mapstructure:"caCertPath"`
	Bucket                  string            `mapstructure:"bucket"`
	Object                  string            `mapstructure:"object"`
	Item                    string            `mapstructure:"item"`
	Prefix                  string            `mapstructure:"prefix"`
	Pattern                 string            `mapstructure:"pattern"`
	GitHubAppPrivateKey     string            `mapstructure:"githubAppPrivateKey"`
	// Deprecated: Please use AuthToken instead
	GithubToken string `mapstructure:"githubToken"`
	Namespace   string `mapstructure:"namespace"`
	Key         string `mapstructure:"key"`
	BaseURL     string `mapstructure:"baseUrl"`
	AuthToken   string `mapstructure:"token"`
	// URI is used by
	// - the postgresql retriever
	// - the mongodb retriever
	URI string `mapstructure:"uri"`
	// Table is used by
	// - the postgresql retriever
	Table          string        `mapstructure:"table"`
	Branch         string        `mapstructure:"branch"`
	Kind           RetrieverKind `mapstructure:"kind"`
	Collection     string        `mapstructure:"collection"`
	RepositorySlug string        `mapstructure:"repositorySlug"`
	RedisPrefix    string        `mapstructure:"redisPrefix"`
	AccountName    string        `mapstructure:"accountName"`
	AccountKey     string        `mapstructure:"accountKey"`
	Container      string        `mapstructure:"container"`
	// GitHub App authentication fields (GitHub retriever only).
	// Mutually exclusive with token / githubToken.
	// AppID and InstallationID are required; supply the private key either inline
	// (GitHubAppPrivateKey) or as a file path (GitHubAppPrivateKeyFile).
	GitHubAppID          int64 `mapstructure:"githubAppId"`
	GitHubInstallationID int64 `mapstructure:"githubInstallationId"`
	Timeout              int64 `mapstructure:"timeout"`
	Recursive            bool  `mapstructure:"recursive"`
}

RetrieverConf contains all the field to configure a retriever.

func (*RetrieverConf) IsValid

func (c *RetrieverConf) IsValid() error

IsValid validates the configuration of the retriever.

type RetrieverKind

type RetrieverKind string

RetrieverKind is an enum containing all accepted Retriever kind.

const (
	// HTTPRetriever is the kind of retriever that retrieves flags over HTTP.
	HTTPRetriever RetrieverKind = "http"
	// GitHubRetriever is the kind of retriever that retrieves flags from GitHub repositories.
	GitHubRetriever RetrieverKind = "github"
	// GitlabRetriever is the kind of retriever that retrieves flags from GitLab repositories.
	GitlabRetriever RetrieverKind = "gitlab"
	// S3Retriever is the kind of retriever that retrieves flags from Amazon S3.
	S3Retriever RetrieverKind = "s3"
	// FileRetriever is the kind of retriever that retrieves flags from local files.
	FileRetriever RetrieverKind = "file"
	// GoogleStorageRetriever is the kind of retriever that retrieves flags from Google Cloud Storage.
	GoogleStorageRetriever RetrieverKind = "googleStorage"
	// KubernetesRetriever is the kind of retriever that retrieves flags from Kubernetes resources.
	KubernetesRetriever RetrieverKind = "configmap"
	// MongoDBRetriever is the kind of retriever that retrieves flags from MongoDB.
	MongoDBRetriever RetrieverKind = "mongodb"
	// RedisRetriever is the kind of retriever that retrieves flags from Redis.
	RedisRetriever RetrieverKind = "redis"
	// BitbucketRetriever is the kind of retriever that retrieves flags from Bitbucket.
	BitbucketRetriever RetrieverKind = "bitbucket"
	// AzBlobStorageRetriever is the kind of retriever that retrieves flags from Azure Blob Storage.
	AzBlobStorageRetriever RetrieverKind = "azureBlobStorage"
	// PostgreSQLRetriever is the kind of retriever that retrieves flags from PostgreSQL.
	PostgreSQLRetriever RetrieverKind = "postgresql"
)

func (RetrieverKind) IsValid

func (r RetrieverKind) IsValid() error

IsValid is checking if the value is part of the enum.

type SerializableRedisOptions

type SerializableRedisOptions struct {
	// Network type, either tcp or unix. Default is tcp.
	Network string `json:"network,omitempty" mapstructure:"network"`
	// Addr is the address formatted as host:port
	Addr string `json:"addr" mapstructure:"addr"`
	// ClientName will execute the `CLIENT SETNAME ClientName` command for each conn.
	ClientName string `json:"clientName,omitempty" mapstructure:"clientName"`
	// IdentitySuffix is an optional suffix to append to the client name.
	IdentitySuffix string `json:"identitySuffix,omitempty" mapstructure:"identitySuffix"`
	// Username is used to authenticate the current connection
	Username string `json:"username,omitempty" mapstructure:"username"`
	// Password is an optional password.
	Password string `json:"password,omitempty" mapstructure:"password"`
	// WriteTimeout for socket writes in milliseconds. If reached, commands will fail
	// with a timeout instead of blocking.
	// Default is ReadTimeout.
	WriteTimeoutMs int64 `json:"writeTimeout,omitempty" mapstructure:"writeTimeout"`
	// PoolSize is the maximum number of socket connections.
	// Default is 10 connections per every available CPU.
	PoolSize int `json:"poolSize,omitempty" mapstructure:"poolSize"`
	// MinRetryBackoff is the minimum backoff between each retry in milliseconds.
	// -1 disables backoff. Default is 8 milliseconds.
	MinRetryBackoffMs int64 `json:"minRetryBackoff,omitempty" mapstructure:"minRetryBackoff"`
	// MaxRetryBackoff is the maximum backoff between each retry in milliseconds.
	// -1 disables backoff. Default is 512 milliseconds.
	MaxRetryBackoffMs int64 `json:"maxRetryBackoff,omitempty" mapstructure:"maxRetryBackoff"`
	// DialTimeout for establishing new connections in milliseconds.
	// Default is 5 seconds (5000ms).
	DialTimeoutMs int64 `json:"dialTimeout,omitempty" mapstructure:"dialTimeout"`
	// ReadTimeout for socket reads in milliseconds. If reached, commands will fail
	// with a timeout instead of blocking.
	// -1 = no timeout (block indefinitely)
	// -2 = disables SetReadDeadline calls completely
	// Default is 3 seconds (3000ms).
	ReadTimeoutMs int64 `json:"readTimeout,omitempty" mapstructure:"readTimeout"`
	// DB is the database to be selected after connecting to the server.
	DB int `json:"db,omitempty" mapstructure:"db"`
	// Protocol 2 or 3. Use the version to negotiate RESP version with redis-server.
	// Default is 3.
	Protocol int `json:"protocol,omitempty" mapstructure:"protocol"`
	// ConnMaxLifetime is the maximum amount of time a connection may be reused in milliseconds.
	// Default is to not close aged connections.
	ConnMaxLifetimeMs int64 `json:"connMaxLifetime,omitempty" mapstructure:"connMaxLifetime"`
	// MaxRetries is the maximum number of retries before giving up.
	// -1 (not 0) disables retries. Default is 3 retries.
	MaxRetries int `json:"maxRetries,omitempty" mapstructure:"maxRetries"`
	// PoolTimeout is the amount of time client waits for connection if all
	// connections are busy before returning an error in milliseconds.
	// Default is ReadTimeout + 1 second.
	PoolTimeoutMs int64 `json:"poolTimeout,omitempty" mapstructure:"poolTimeout"`
	// MinIdleConns is the minimum number of idle connections which is useful when
	// establishing new connection is slow.
	// Default is 0 (no idle connections are retained).
	MinIdleConns int `json:"minIdleConns,omitempty" mapstructure:"minIdleConns"`
	// MaxIdleConns is the maximum number of idle connections.
	// Default is 0 (unlimited).
	MaxIdleConns int `json:"maxIdleConns,omitempty" mapstructure:"maxIdleConns"`
	// ConnMaxIdleTime is the maximum amount of time a connection may be idle in milliseconds.
	// Should be less than server's timeout.
	// Default is 30 minutes (1800000ms). -1 disables idle timeout check.
	ConnMaxIdleTimeMs int64 `json:"connMaxIdleTime,omitempty" mapstructure:"connMaxIdleTime"`
	// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).
	PoolFIFO bool `json:"poolFifo,omitempty" mapstructure:"poolFIFO"`
	// TLS Config (simplified - only enable/disable for now)
	// For more complex TLS configurations, use the non-serializable RedisOptions
	TLSEnabled bool `json:"tlsEnabled,omitempty" mapstructure:"tlsEnabled"`
	// DisableIndentity disables set-lib on connect.
	DisableIndentity bool `json:"disableIndentity,omitempty" mapstructure:"disableIndentity"`
	// DisableIdentity disables set-lib on connect.
	DisableIdentity bool `json:"disableIdentity,omitempty" mapstructure:"disableIdentity"`
	// ContextTimeoutEnabled controls whether the client respects context timeouts and deadlines.
	// Default is false.
	ContextTimeoutEnabled bool `json:"contextTimeoutEnabled,omitempty" mapstructure:"contextTimeoutEnabled"` //nolint:lll // struct tags (json, yaml, toml, jsonschema, mapstructure) can not be wrapped
}

SerializableRedisOptions is a JSON-serializable alternative to redis.Options. It contains only the fields that can be serialized and are most commonly used. This allows the configuration to be passed via command line or JSON files.

func (*SerializableRedisOptions) ToRedisOptions

func (s *SerializableRedisOptions) ToRedisOptions() *redis.Options

ToRedisOptions converts SerializableRedisOptions to redis.Options.

Directories

Path Synopsis
Package init creates the retrievers from their configuration.
Package init creates the retrievers from their configuration.

Jump to

Keyboard shortcuts

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