config

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package config provides Trickster configuration abilities, including parsing and printing configuration files, command line parameters, and environment variables, as well as default values and state.

Index

Constants

View Source
const (
	// CacheTypeMemory indicates a memory cache
	CacheTypeMemory = CacheType(iota)
	// CacheTypeFilesystem indicates a filesystem cache
	CacheTypeFilesystem
	// CacheTypeRedis indicates a Redis cache
	CacheTypeRedis
	// CacheTypeBbolt indicates a Bbolt cache
	CacheTypeBbolt
	// CacheTypeBadgerDB indicates a BadgerDB cache
	CacheTypeBadgerDB
)
View Source
const (
	// CFTypeBasic indicates a basic cache
	CFTypeBasic = CollapsedForwardingType(iota)
	// CFTypeProgressive indicates a progressive cache
	CFTypeProgressive
)
View Source
const (
	// OriginTypeRPC represents thee Reverse Proxy Cache origin type
	OriginTypeRPC = OriginType(iota)
	// OriginTypePrometheus represents the Prometheus origin type
	OriginTypePrometheus
	// OriginTypeInfluxDB represents the InfluxDB origin type
	OriginTypeInfluxDB
	// OriginTypeIronDB represents the IRONdb origin type
	OriginTypeIronDB
	// OriginTypeClickHouse represents the ClickHouse origin type
	OriginTypeClickHouse
)
View Source
const (
	// PathMatchTypeExact indicates the router will map the Path by exact match against incoming requests
	PathMatchTypeExact = PathMatchType(iota)
	// PathMatchTypePrefix indicates the router will map the Path by prefix against incoming requests
	PathMatchTypePrefix
)
View Source
const (
	// EvictionMethodOldest indicates that a time series cache object only holds values newer than an explicit date,
	// called the Oldest Cacheable Timestamp, which is calculated with this formula on each request:
	// time.Now().Add(-(config.ValueRetentionFactor * query.Step))
	// This policy is the more performant methodology, because out-of-cache-range determination does not require querying
	// the cache; thus the cache is only accessed for requests that are pre-determined to be cacheable
	EvictionMethodOldest = TimeseriesEvictionMethod(iota)
	// EvictionMethodLRU indicates a that a time series cache object hold up to ValueRetentionFactor number of
	// unique timestamps, removing the least-recently-used timestamps as necessary to to remain at the ValueRetentionFactor
	// This policy is the more compute-intensive, since we must maintain an LRU on each timestamp in each cache object,
	// and retrieve the object from cache on each request
	EvictionMethodLRU
)
View Source
const (

	// DefaultConfigPath defines the default location of the Trickster config file
	DefaultConfigPath = "/etc/trickster/trickster.conf"
)

Variables

View Source
var CacheTypeNames = map[string]CacheType{
	"memory":     CacheTypeMemory,
	"filesystem": CacheTypeFilesystem,
	"redis":      CacheTypeRedis,
	"bbolt":      CacheTypeBbolt,
	"badger":     CacheTypeBadgerDB,
}

CacheTypeNames is a map of cache types keyed by name

View Source
var CacheTypeValues = map[CacheType]string{
	CacheTypeMemory:     "memory",
	CacheTypeFilesystem: "filesystem",
	CacheTypeRedis:      "redis",
	CacheTypeBbolt:      "bbolt",
	CacheTypeBadgerDB:   "badger",
}

CacheTypeValues is a map of cache types keyed by internal id

View Source
var Caches map[string]*CachingConfig

Caches is the Cache Map subsection of the Running Configuration

View Source
var CollapsedForwardingTypeNames = map[string]CollapsedForwardingType{
	"basic":       CFTypeBasic,
	"progressive": CFTypeProgressive,
}

CollapsedForwardingTypeNames is a map of cache types keyed by name

View Source
var CollapsedForwardingTypeValues = map[CollapsedForwardingType]string{
	CFTypeBasic:       "basic",
	CFTypeProgressive: "progressive",
}

CollapsedForwardingTypeValues is a map of cache types keyed by internal id

View Source
var Flags = TricksterFlags{}

Flags is a collection of command line flags that Trickster loads.

View Source
var LoaderWarnings = make([]string, 0)

LoaderWarnings holds warnings generated during config load (before the logger is initialized), so they can be logged at the end of the loading process

View Source
var NegativeCacheConfigs map[string]NegativeCacheConfig

NegativeCacheConfigs is the NegativeCacheConfig subsection of the Running Configuration

View Source
var Origins map[string]*OriginConfig

Origins is the Origin Map subsection of the Running Configuration

View Source
var TracingConfigs map[string]*TracingConfig

TracingConfigs is the TracingConfigs subsection of the Running Configuration

Functions

func IsValidOriginType

func IsValidOriginType(t string) bool

IsValidOriginType returns true if the provided OriginType is valid for use with Trickster

func Load

func Load(applicationName string, applicationVersion string, arguments []string) error

Load returns the Application Configuration, starting with a default config, then overriding with any provided config file, then env vars, and finally flags

Types

type BBoltCacheConfig

type BBoltCacheConfig struct {
	// Filename represents the filename (including path) of the BotlDB database
	Filename string `toml:"filename"`
	// Bucket represents the name of the bucket within BBolt under which Trickster's keys will be stored.
	Bucket string `toml:"bucket"`
}

BBoltCacheConfig is a collection of Configurations for storing cached data on the Filesystem

type BadgerCacheConfig

type BadgerCacheConfig struct {
	// Directory represents the path on disk where the Badger database should store data
	Directory string `toml:"directory"`
	// ValueDirectory represents the path on disk where the Badger database will store its value log.
	ValueDirectory string `toml:"value_directory"`
}

BadgerCacheConfig is a collection of Configurations for storing cached data on the Filesystem in a Badger key-value store

type CacheIndexConfig

type CacheIndexConfig struct {
	// ReapIntervalSecs defines how long the Cache Index reaper sleeps between reap cycles
	ReapIntervalSecs int `toml:"reap_interval_secs"`
	// FlushIntervalSecs sets how often the Cache Index saves its metadata to the cache from application memory
	FlushIntervalSecs int `toml:"flush_interval_secs"`
	// MaxSizeBytes indicates how large the cache can grow in bytes before the Index evicts
	// least-recently-accessed items.
	MaxSizeBytes int64 `toml:"max_size_bytes"`
	// MaxSizeBackoffBytes indicates how far below max_size_bytes the cache size must be
	// to complete a byte-size-based eviction exercise.
	MaxSizeBackoffBytes int64 `toml:"max_size_backoff_bytes"`
	// MaxSizeObjects  indicates how large the cache can grow in objects before the Index
	// evicts least-recently-accessed items.
	MaxSizeObjects int64 `toml:"max_size_objects"`
	// MaxSizeBackoffObjects indicates how far under max_size_objects the cache size must
	// be to complete object-size-based eviction exercise.
	MaxSizeBackoffObjects int64 `toml:"max_size_backoff_objects"`

	ReapInterval  time.Duration `toml:"-"`
	FlushInterval time.Duration `toml:"-"`
}

CacheIndexConfig defines the operation of the Cache Indexer

type CacheType

type CacheType int

CacheType enumerates the methodologies for maintaining time series cache data

func (CacheType) String

func (t CacheType) String() string

type CachingConfig

type CachingConfig struct {
	// Name is the Name of the cache, taken from the Key in the Caches map[string]*CacheConfig
	Name string `toml:"-"`
	// Type represents the type of cache that we wish to use: "boltdb", "memory", "filesystem", or "redis"
	CacheType string `toml:"cache_type"`
	// Index provides options for the Cache Index
	Index CacheIndexConfig `toml:"index"`
	// Redis provides options for Redis caching
	Redis RedisCacheConfig `toml:"redis"`
	// Filesystem provides options for Filesystem caching
	Filesystem FilesystemCacheConfig `toml:"filesystem"`
	// BBolt provides options for BBolt caching
	BBolt BBoltCacheConfig `toml:"bbolt"`
	// Badger provides options for BadgerDB caching
	Badger BadgerCacheConfig `toml:"badger"`

	// CacheTypeID represents the internal constant for the provided CacheType string
	// and is automatically populated at startup
	CacheTypeID CacheType `toml:"-"`
}

CachingConfig is a collection of defining the Trickster Caching Behavior

func NewCacheConfig

func NewCacheConfig() *CachingConfig

NewCacheConfig will return a pointer to an OriginConfig with the default configuration settings

func (*CachingConfig) Clone

func (cc *CachingConfig) Clone() *CachingConfig

Clone returns an exact copy of a *CachingConfig

type CollapsedForwardingType

type CollapsedForwardingType int

CollapsedForwardingType enumerates the methodologies for maintaining time series cache data

func (CollapsedForwardingType) String

func (t CollapsedForwardingType) String() string

type FilesystemCacheConfig

type FilesystemCacheConfig struct {
	// CachePath represents the path on disk where our cache will live
	CachePath string `toml:"cache_path"`
}

FilesystemCacheConfig is a collection of Configurations for storing cached data on the Filesystem

type FrontendConfig

type FrontendConfig struct {
	// ListenAddress is IP address for the main http listener for the application
	ListenAddress string `toml:"listen_address"`
	// ListenPort is TCP Port for the main http listener for the application
	ListenPort int `toml:"listen_port"`
	// TLSListenAddress is IP address for the tls  http listener for the application
	TLSListenAddress string `toml:"tls_listen_address"`
	// TLSListenPort is the TCP Port for the tls http listener for the application
	TLSListenPort int `toml:"tls_listen_port"`
	// ConnectionsLimit indicates how many concurrent front end connections trickster will handle at any time
	ConnectionsLimit int `toml:"connections_limit"`

	// ServeTLS indicates whether to listen and serve on the TLS port, meaning
	// at least one origin configuration has a valid certificate and key file configured.
	ServeTLS bool `toml:"-"`
}

FrontendConfig is a collection of configurations for the main http frontend for the application

var Frontend *FrontendConfig

Frontend is the Proxy Server subsection of the Running Configuration

type KeyHasherFunc

type KeyHasherFunc func(path string, params url.Values, headers http.Header, body io.ReadCloser, extra string) (string, io.ReadCloser)

KeyHasherFunc is a custom function that returns a hashed key value string for cache objects

type LoggingConfig

type LoggingConfig struct {
	// LogFile provides the filepath to the instances's logfile. Set as empty string to Log to Console
	LogFile string `toml:"log_file"`
	// LogLevel provides the most granular level (e.g., DEBUG, INFO, ERROR) to log
	LogLevel string `toml:"log_level"`
}

LoggingConfig is a collection of Logging configurations

var Logging *LoggingConfig

Logging is the Logging subsection of the Running Configuration

type MainConfig

type MainConfig struct {
	// InstanceID represents a unique ID for the current instance, when multiple instances on the same host
	InstanceID int `toml:"instance_id"`
	// ConfigHandlerPath provides the path to register the Config Handler for outputting the running configuration
	ConfigHandlerPath string `toml:"config_handler_path"`
	// PingHandlerPath provides the path to register the Ping Handler for checking that Trickster is running
	PingHandlerPath string `toml:"ping_handler_path"`
}

MainConfig is a collection of general configuration values.

var Main *MainConfig

Main is the Main subsection of the Running Configuration

type MetricsConfig

type MetricsConfig struct {
	// ListenAddress is IP address from which the Application Metrics are available for pulling at /metrics
	ListenAddress string `toml:"listen_address"`
	// ListenPort is TCP Port from which the Application Metrics are available for pulling at /metrics
	ListenPort int `toml:"listen_port"`
}

MetricsConfig is a collection of Metrics Collection configurations

var Metrics *MetricsConfig

Metrics is the Metrics subsection of the Running Configuration

type NegativeCacheConfig

type NegativeCacheConfig map[string]int

NegativeCacheConfig is a collection of response codes and their TTLs

func NewNegativeCacheConfig

func NewNegativeCacheConfig() NegativeCacheConfig

NewNegativeCacheConfig returns an empty NegativeCacheConfig

func (NegativeCacheConfig) Clone

Clone returns an exact copy of a NegativeCacheConfig

type OriginConfig

type OriginConfig struct {

	// HTTP and Proxy Configurations
	//
	// Hosts identifies the frontend hostnames this origin should handle (virtual hosting)
	Hosts []string `toml:"hosts"`
	// IsDefault indicates if this is the default origin for any request not matching a configured route
	IsDefault bool `toml:"is_default"`
	// OriginType describes the type of origin (e.g., 'prometheus')
	OriginType string `toml:"origin_type"`
	// OriginURL provides the base upstream URL for all proxied requests to this origin.
	// it can be as simple as http://example.com or as complex as https://example.com:8443/path/prefix
	OriginURL string `toml:"origin_url"`
	// TimeoutSecs defines how long the HTTP request will wait for a response before timing out
	TimeoutSecs int64 `toml:"timeout_secs"`
	// KeepAliveTimeoutSecs defines how long an open keep-alive HTTP connection remains idle before closing
	KeepAliveTimeoutSecs int64 `toml:"keep_alive_timeout_secs"`
	// MaxIdleConns defines maximum number of open keep-alive connections to maintain
	MaxIdleConns int `toml:"max_idle_conns"`
	// CacheName provides the name of the configured cache where the origin client will store it's cache data
	CacheName string `toml:"cache_name"`
	// CacheKeyPrefix defines the cache key prefix the origin will use when writing objects to the cache
	CacheKeyPrefix string `toml:"cache_key_prefix"`
	// HealthCheckUpstreamPath provides the URL path for the upstream health check
	HealthCheckUpstreamPath string `toml:"health_check_upstream_path"`
	// HealthCheckVerb provides the HTTP verb to use when making an upstream health check
	HealthCheckVerb string `toml:"health_check_verb"`
	// HealthCheckQuery provides the HTTP query parameters to use when making an upstream health check
	HealthCheckQuery string `toml:"health_check_query"`
	// HealthCheckHeaders provides the HTTP Headers to apply when making an upstream health check
	HealthCheckHeaders map[string]string `toml:"health_check_headers"`
	// Object Proxy Cache and Delta Proxy Cache Configurations
	// TimeseriesRetentionFactor limits the maximum the number of chronological timestamps worth of data to store in cache for each query
	TimeseriesRetentionFactor int `toml:"timeseries_retention_factor"`
	// TimeseriesEvictionMethodName specifies which methodology ("oldest", "lru") is used to identify timeseries to evict from a full cache object
	TimeseriesEvictionMethodName string `toml:"timeseries_eviction_method"`
	// FastForwardDisable indicates whether the FastForward feature should be disabled for this origin
	FastForwardDisable bool `toml:"fast_forward_disable"`
	// BackfillToleranceSecs prevents values with timestamps newer than the provided number of seconds from being cached
	// this allows propagation of upstream backfill operations that modify recently-served data
	BackfillToleranceSecs int64 `toml:"backfill_tolerance_secs"`
	// PathList is a list of PathConfigs that control the behavior of the given paths when requested
	Paths map[string]*PathConfig `toml:"paths"`
	// NegativeCacheName provides the name of the Negative Cache Config to be used by this Origin
	NegativeCacheName string `toml:"negative_cache_name"`
	// TimeseriesTTLSecs specifies the cache TTL of timeseries objects
	TimeseriesTTLSecs int `toml:"timeseries_ttl_secs"`
	// TimeseriesTTLSecs specifies the cache TTL of fast forward data
	FastForwardTTLSecs int `toml:"fastforward_ttl_secs"`
	// MaxTTLSecs specifies the maximum allowed TTL for any cache object
	MaxTTLSecs int `toml:"max_ttl_secs"`
	// RevalidationFactor specifies how many times to multiply the object freshness lifetime by to calculate an absolute cache TTL
	RevalidationFactor float64 `toml:"revalidation_factor"`
	// MaxObjectSizeBytes specifies the max objectsize to be accepted for any given cache object
	MaxObjectSizeBytes int `toml:"max_object_size_bytes"`
	// CompressableTypeList specifies the HTTP Object Content Types that will be compressed internally when stored in the Trickster cache
	CompressableTypeList []string `toml:"compressable_types"`
	// TracingConfigName provides the name of the Tracing Config to be used by this Origin
	TracingConfigName string `toml:"tracing_name"`

	// TLS is the TLS Configuration for the Frontend and Backend
	TLS *TLSConfig `toml:"tls"`
	// RequireTLS, when true, indicates this Origin Config's paths must only be registered with the TLS Router
	RequireTLS bool `toml:"require_tls"`

	// MultipartRangesDisabled, when true, indicates that if a downstream client requests multiple ranges in a single Range request,
	// Trickster will instead request and return a 200 OK with the full object body
	MultipartRangesDisabled bool `toml:"multipart_ranges_disabled"`
	// DearticulateUpstreamRanges, when true, indicates that when Trickster requests multiple ranges from the origin,
	// that they be requested as individual upstream requests instead of a single request that expects a multipart response
	// this optimizes Trickster to request as few bytes as possible when fronting origins that only support single range requests
	DearticulateUpstreamRanges bool `toml:"dearticulate_upstream_ranges"`

	// Synthesized Configurations
	// These configurations are parsed versions of those defined above, and are what Trickster uses internally
	//
	// Name is the Name of the origin, taken from the Key in the Origins map[string]*OriginConfig
	Name string `toml:"-"`
	// Timeout is the time.Duration representation of TimeoutSecs
	Timeout time.Duration `toml:"-"`
	// BackfillTolerance is the time.Duration representation of BackfillToleranceSecs
	BackfillTolerance time.Duration `toml:"-"`
	// ValueRetention is the time.Duration representation of ValueRetentionSecs
	ValueRetention time.Duration `toml:"-"`
	// Scheme is the layer 7 protocol indicator (e.g. 'http'), derived from OriginURL
	Scheme string `toml:"-"`
	// Host is the upstream hostname/IP[:port] the origin client will connect to when fetching uncached data, derived from OriginURL
	Host string `toml:"-"`
	// PathPrefix provides any prefix added to the front of the requested path when constructing the upstream request url, derived from OriginURL
	PathPrefix string `toml:"-"`
	// NegativeCache provides a map for the negative cache, with TTLs converted to time.Durations
	NegativeCache map[int]time.Duration `toml:"-"`
	// TimeseriesRetention when subtracted from time.Now() represents the oldest allowable timestamp in a timeseries when EvictionMethod is 'oldest'
	TimeseriesRetention time.Duration `toml:"-"`
	// TimeseriesEvictionMethod is the parsed value of TimeseriesEvictionMethodName
	TimeseriesEvictionMethod TimeseriesEvictionMethod `toml:"-"`
	// TimeseriesTTL is the parsed value of TimeseriesTTLSecs
	TimeseriesTTL time.Duration `toml:"-"`
	// FastForwardTTL is the parsed value of FastForwardTTL
	FastForwardTTL time.Duration `toml:"-"`
	// FastForwardPath is the PathConfig to use for upstream Fast Forward Requests
	FastForwardPath *PathConfig `toml:"-"`
	// MaxTTL is the parsed value of MaxTTLSecs
	MaxTTL time.Duration `toml:"-"`
	// HTTPClient is the Client used by trickster to communicate with this origin
	HTTPClient *http.Client `toml:"-"`
	// CompressableTypes is the map version of CompressableTypeList for fast lookup
	CompressableTypes map[string]bool `toml:"-"`
	// TracingConfig is the reference to the Tracing Config as indicated by TracingConfigName
	TracingConfig *TracingConfig `toml:"-"`
}

OriginConfig is a collection of configurations for prometheus origins proxied by Trickster

func NewOriginConfig

func NewOriginConfig() *OriginConfig

NewOriginConfig will return a pointer to an OriginConfig with the default configuration settings

func (*OriginConfig) Clone

func (oc *OriginConfig) Clone() *OriginConfig

Clone returns an exact copy of an *OriginConfig

type OriginType

type OriginType int

OriginType enumerates the supported origin types

func (OriginType) String

func (t OriginType) String() string

type PathConfig

type PathConfig struct {
	// Path indicates the HTTP Request's URL PATH to which this configuration applies
	Path string `toml:"path"`
	// MatchTypeName indicates the type of path match the router will apply to the path ('exact' or 'prefix')
	MatchTypeName string `toml:"match_type"`
	// HandlerName provides the name of the HTTP handler to use
	HandlerName string `toml:"handler"`
	// Methods provides the list of permitted HTTP request methods for this Path
	Methods []string `toml:"methods"`
	// CacheKeyParams provides the list of http request query parameters to be included in the hash for each request's cache key
	CacheKeyParams []string `toml:"cache_key_params"`
	// CacheKeyHeaders provides the list of http request headers to be included in the hash for each request's cache key
	CacheKeyHeaders []string `toml:"cache_key_headers"`
	// CacheKeyFormFields provides the list of http request body fields to be included in the hash for each request's cache key
	CacheKeyFormFields []string `toml:"cache_key_form_fields"`
	// RequestHeaders is a map of headers that will be added to requests to the upstream Origin for this path
	RequestHeaders map[string]string `toml:"request_headers"`
	// RequestParams is a map of headers that will be added to requests to the upstream Origin for this path
	RequestParams map[string]string `toml:"request_params"`
	// ResponseHeaders is a map of http headers that will be added to responses to the downstream client
	ResponseHeaders map[string]string `toml:"response_headers"`
	// ResponseCode sets a custom response code to be sent to downstream clients for this path.
	ResponseCode int `toml:"response_code"`
	// ResponseBody sets a custom response body to be sent to the donstream client for this path.
	ResponseBody string `toml:"response_body"`
	// NoMetrics, when set to true, disables metrics decoration for the path
	NoMetrics bool `toml:"no_metrics"`
	// CollapsedForwardingName indicates 'basic' or 'progressive' Collapsed Forwarding to be used by this path.
	CollapsedForwardingName string `toml:"collapsed_forwarding"`

	// Synthesized PathConfig Values
	//
	// Handler is the HTTP Handler represented by the Path's HandlerName
	Handler http.Handler `toml:"-"`
	// HasCustomResponseBody is a boolean indicating if the response body is custom
	// this flag allows an empty string response to be configured as a return value
	HasCustomResponseBody bool `toml:"-"`
	// ResponseBodyBytes provides a byte slice version of the ResponseBody value
	ResponseBodyBytes []byte `toml:"-"`
	// MatchType is the PathMatchType representation of MatchTypeName
	MatchType PathMatchType `toml:"-"`
	// CollapsedForwardingType is the typed representation of CollapsedForwardingName
	CollapsedForwardingType CollapsedForwardingType `toml:"-"`
	// OriginConfig is the reference to the PathConfig's parent Origin Config
	OriginConfig *OriginConfig `toml:"-"`
	// KeyHasher points to an optional function that hashes the cacheKey with a custom algorithm
	// NOTE: This is used by some origins like IronDB, but is not configurable by end users
	// due to a bug in the vendored toml package, this must be a slice to avoid panic
	KeyHasher []KeyHasherFunc `toml:"-"`
	// contains filtered or unexported fields
}

PathConfig defines a URL Path that is associated with an HTTP Handler

func NewPathConfig

func NewPathConfig() *PathConfig

NewPathConfig returns a newly-instantiated *PathConfig

func (*PathConfig) Clone

func (p *PathConfig) Clone() *PathConfig

Clone returns an exact copy of the subject PathConfig

func (*PathConfig) Merge

func (p *PathConfig) Merge(p2 *PathConfig)

Merge merges the non-default values of the provided PathConfig into the subject PathConfig

type PathMatchType

type PathMatchType int

PathMatchType enumerates the types of Path Matches used when registering Paths with the Router

func (PathMatchType) String

func (t PathMatchType) String() string

type RedisCacheConfig

type RedisCacheConfig struct {
	// ClientType defines the type of Redis Client ("standard", "cluster", "sentinel")
	ClientType string `toml:"client_type"`
	// Protocol represents the connection method (e.g., "tcp", "unix", etc.)
	Protocol string `toml:"protocol"`
	// Endpoint represents FQDN:port or IPAddress:Port of the Redis Endpoint
	Endpoint string `toml:"endpoint"`
	// Endpoints represents FQDN:port or IPAddress:Port collection of a Redis Cluster or Sentinel Nodes
	Endpoints []string `toml:"endpoints"`
	// Password can be set when using password protected redis instance.
	Password string `toml:"password"`
	// SentinelMaster should be set when using Redis Sentinel to indicate the Master Node
	SentinelMaster string `toml:"sentinel_master"`
	// DB is the Database to be selected after connecting to the server.
	DB int `toml:"db"`
	// MaxRetries is the maximum number of retries before giving up on the command
	MaxRetries int `toml:"max_retries"`
	// MinRetryBackoffMS is the minimum backoff between each retry.
	MinRetryBackoffMS int `toml:"min_retry_backoff_ms"`
	// MaxRetryBackoffMS is the Maximum backoff between each retry.
	MaxRetryBackoffMS int `toml:"max_retry_backoff_ms"`
	// DialTimeoutMS is the timeout for establishing new connections.
	DialTimeoutMS int `toml:"dial_timeout_ms"`
	// ReadTimeoutMS is the timeout for socket reads. If reached, commands will fail with a timeout instead of blocking.
	ReadTimeoutMS int `toml:"read_timeout_ms"`
	// WriteTimeoutMS is the timeout for socket writes. If reached, commands will fail with a timeout instead of blocking.
	WriteTimeoutMS int `toml:"write_timeout_ms"`
	// PoolSize is the maximum number of socket connections.
	PoolSize int `toml:"pool_size"`
	// MinIdleConns is the minimum number of idle connections which is useful when establishing new connection is slow.
	MinIdleConns int `toml:"min_idle_conns"`
	// MaxConnAgeMS is the connection age at which client retires (closes) the connection.
	MaxConnAgeMS int `toml:"max_conn_age_ms"`
	// PoolTimeoutMS is the amount of time client waits for connection if all connections are busy before returning an error.
	PoolTimeoutMS int `toml:"pool_timeout_ms"`
	// IdleTimeoutMS is the amount of time after which client closes idle connections.
	IdleTimeoutMS int `toml:"idle_timeout_ms"`
	// IdleCheckFrequencyMS is the frequency of idle checks made by idle connections reaper.
	IdleCheckFrequencyMS int `toml:"idle_check_frequency_ms"`
}

RedisCacheConfig is a collection of Configurations for Connecting to Redis

type TLSConfig

type TLSConfig struct {
	// FullChainCertPath specifies the path of the file containing the
	// concatenated server certification and the intermediate certification for the tls endpoint
	FullChainCertPath string `toml:"full_chain_cert_path"`
	// PrivateKeyPath specifies the path of the private key file for the tls endpoint
	PrivateKeyPath string `toml:"private_key_path"`
	// ServeTLS is set to true once the Cert and Key files have been validated,
	// indicating the consumer of this config can service requests over TLS
	ServeTLS bool `toml:"-"`
	// InsecureSkipVerify indicates that the HTTPS Client in Trickster should bypass
	// hostname verification for the origin's certificate when proxying requests
	InsecureSkipVerify bool `toml:"insecure_skip_verify"`
	// CertificateAuthorities provides a list of custom Certificate Authorities for the upstream origin
	// which are considered in addition to any system CA's by the Trickster HTTPS Client
	CertificateAuthorityPaths []string `toml:"certificate_authority_paths"`
	// ClientCertPath provides the path to the Client Certificate when using Mutual Authorization
	ClientCertPath string `toml:"client_cert_path"`
	// ClientKeyPath provides the path to the Client Key when using Mutual Authorization
	ClientKeyPath string `toml:"client_key_path"`
}

TLSConfig is a collection of TLS-related client and server configurations

func DefaultTLSConfig

func DefaultTLSConfig() *TLSConfig

DefaultTLSConfig will return a *TLSConfig with the default settings

func (*TLSConfig) Clone

func (tc *TLSConfig) Clone() *TLSConfig

Clone returns an exact copy of the subject *TLSConfig

type TimeseriesEvictionMethod

type TimeseriesEvictionMethod int

TimeseriesEvictionMethod enumerates the methodologies for maintaining time series cache data

func (TimeseriesEvictionMethod) String

func (t TimeseriesEvictionMethod) String() string

type TracingConfig

type TracingConfig struct {
	// Name is the name of the Tracing Config
	Name string `toml:"-"`
	// Implementation is the particular implementation to use. Ex OpenTelemetry.
	// TODO generate with Rob Pike's Stringer
	Implementation string `toml:"implementation"`
	// Exporter is the format used to send to the collector
	Exporter string `toml:"exporter"`
	// CollectorEndpoint is the URL of the trace collector it MUST be of Implementation implementation
	CollectorEndpoint string `toml:"collector"`
	// SampleRate sets the probability that a span will be recorded. Values between 0 and 1 are accepted.
	SampleRate float64 `toml:"sample_rate"`

	// Tracer is the actual Tracer Object associated with this configuration once loaded
	Tracer trace.Tracer `toml:"-"`
}

TracingConfig provides the distributed tracing configuration

func NewTracingConfig

func NewTracingConfig() *TracingConfig

NewTracingConfig returns a new tracing config with default values

func (*TracingConfig) Clone

func (tc *TracingConfig) Clone() *TracingConfig

Clone returns an exact copy of a tracing config

type TricksterConfig

type TricksterConfig struct {
	// Main is the primary MainConfig section
	Main *MainConfig `toml:"main"`
	// Origins is a map of OriginConfigs
	Origins map[string]*OriginConfig `toml:"origins"`
	// Caches is a map of CacheConfigs
	Caches map[string]*CachingConfig `toml:"caches"`
	// ProxyServer is provides configurations about the Proxy Front End
	Frontend *FrontendConfig `toml:"frontend"`
	// Logging provides configurations that affect logging behavior
	Logging *LoggingConfig `toml:"logging"`
	// Metrics provides configurations for collecting Metrics about the application
	Metrics *MetricsConfig `toml:"metrics"`
	// TracingConfigs provides the distributed tracing configuration
	TracingConfigs map[string]*TracingConfig `toml:"tracing"`
	// NegativeCacheConfigs is a map of NegativeCacheConfigs
	NegativeCacheConfigs map[string]NegativeCacheConfig `toml:"negative_caches"`
	// contains filtered or unexported fields
}

TricksterConfig is the main configuration object

var Config *TricksterConfig

Config is the Running Configuration for Trickster

func NewConfig

func NewConfig() *TricksterConfig

NewConfig returns a Config initialized with default values.

func (*TricksterConfig) String

func (c *TricksterConfig) String() string

func (*TricksterConfig) TLSCertConfig

func (c *TricksterConfig) TLSCertConfig() (*tls.Config, error)

TLSCertConfig returns the crypto/tls configuration object with a list of name-bound certs derifed from the running config

type TricksterFlags

type TricksterFlags struct {
	PrintVersion bool
	ConfigPath   string

	Origin            string
	OriginType        string
	ProxyListenPort   int
	MetricsListenPort int
	LogLevel          string
	InstanceID        int
	// contains filtered or unexported fields
}

TricksterFlags holds the values for whitelisted flags

Jump to

Keyboard shortcuts

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