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 ¶
This section is empty.
Variables ¶
var ErrInvalidPprofServerName = errors.New("invalid pprof server name")
ErrInvalidPprofServerName returns an error for invalid pprof server name
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Main is the primary MainConfig section
Main *MainConfig `toml:"main"`
// Origins is a map of OriginConfigs
Origins map[string]*origins.Options `toml:"origins"`
// Caches is a map of CacheConfigs
Caches map[string]*cache.Options `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]*tracing.Options `toml:"tracing"`
// NegativeCacheConfigs is a map of NegativeCacheConfigs
NegativeCacheConfigs map[string]NegativeCacheConfig `toml:"negative_caches"`
// Rules is a map of the Rules
Rules map[string]*rule.Options `toml:"rules"`
// RequestRewriters is a map of the Rewriters
RequestRewriters map[string]*rwopts.Options `toml:"request_rewriters"`
// ReloadConfig provides configurations for in-process config reloading
ReloadConfig *reload.Options `toml:"reloading"`
// Resources holds runtime resources uses by the Config
Resources *Resources `toml:"-"`
CompiledRewriters map[string]rewriter.RewriteInstructions `toml:"-"`
LoaderWarnings []string `toml:"-"`
// contains filtered or unexported fields
}
Config is the main configuration object
func NewConfig ¶
func NewConfig() *Config
NewConfig returns a Config initialized with default values.
func (*Config) CheckFileLastModified ¶
CheckFileLastModified returns the last modified date of the running config file, if present
func (*Config) ConfigFilePath ¶
ConfigFilePath returns the file path from which this configuration is based
type Flags ¶
type Flags struct {
PrintVersion bool
ValidateConfig bool
ProxyListenPort int
MetricsListenPort int
InstanceID int
ConfigPath string
Origin string
OriginType string
LogLevel string
// contains filtered or unexported fields
}
Flags holds the values for whitelisted flags
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
func (*FrontendConfig) Equal ¶
func (fc *FrontendConfig) Equal(fc2 *FrontendConfig) bool
Equal returns true if the FrontendConfigs are identical in value.
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
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"`
// ReloadHandlerPath provides the path to register the Config Reload Handler
ReloadHandlerPath string `toml:"reload_handler_path"`
// HeatlHandlerPath provides the base Health Check Handler path
HealthHandlerPath string `toml:"health_handler_path"`
// PprofServer provides the name of the http listener that will host the pprof debugging routes
// Options are: "metrics", "reload", "both", or "off"; default is both
PprofServer string `toml:"pprof_server"`
// ServerName represents the server name that is conveyed in Via headers to upstream origins
// defaults to os.Hostname
ServerName string `toml:"server_name"`
// ReloaderLock is used to lock the config for reloading
ReloaderLock sync.Mutex `toml:"-"`
// contains filtered or unexported fields
}
MainConfig is a collection of general configuration values.
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
type NegativeCacheConfig ¶
NegativeCacheConfig is a collection of response codes and their TTLs
func NewNegativeCacheConfig ¶
func NewNegativeCacheConfig() NegativeCacheConfig
NewNegativeCacheConfig returns an empty NegativeCacheConfig
func (NegativeCacheConfig) Clone ¶
func (nc NegativeCacheConfig) Clone() NegativeCacheConfig
Clone returns an exact copy of a NegativeCacheConfig
Directories
¶
| Path | Synopsis |
|---|---|
|
Package reload helps with reloading the running Trickster configuration
|
Package reload helps with reloading the running Trickster configuration |
|
options
Package options provides options for configuration reload support
|
Package options provides options for configuration reload support |