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
- type Config
- func (c *Config) CheckFileLastModified() time.Time
- func (c *Config) Clone() *Config
- func (c *Config) ConfigFilePath() string
- func (c *Config) IsStale() bool
- func (c *Config) OverlayYAMLData(md yamlx.KeyLookup) error
- func (c *Config) Process() error
- func (c *Config) String() string
- func (c *Config) TLSCertConfig() (*tls.Config, error)
- type Flags
- type MainConfig
- type Resources
Constants ¶
const (
// DefaultConfigPath defines the default location of the Trickster config file
DefaultConfigPath = "/etc/trickster/trickster.yaml"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Main is the primary MainConfig section
Main *MainConfig `yaml:"main,omitempty"`
// Backends is a map of BackendOptions
Backends bo.Lookup `yaml:"backends,omitempty"`
// Caches is a map of CacheConfigs
Caches cache.Lookup `yaml:"caches,omitempty"`
// Frontend provides configurations about the Proxy Front End
Frontend *fropt.Options `yaml:"frontend,omitempty"`
// Logging provides configurations that affect logging behavior
Logging *lo.Options `yaml:"logging,omitempty"`
// Metrics provides configurations for collecting Metrics about the application
Metrics *mo.Options `yaml:"metrics,omitempty"`
// TracingConfigs provides the distributed tracing configuration
TracingConfigs tracing.Lookup `yaml:"tracing,omitempty"`
// NegativeCacheConfigs is a map of NegativeCacheConfigs
NegativeCacheConfigs negative.ConfigLookup `yaml:"negative_caches,omitempty"`
// Rules is a map of the Rules
Rules rule.Lookup `yaml:"rules,omitempty"`
// RequestRewriters is a map of the Rewriters
RequestRewriters rwopts.Lookup `yaml:"request_rewriters,omitempty"`
// MgmtConfig provides configurations for managing the trickster process
// including reloading, purging cache entries, and health checks
MgmtConfig *mgmt.Options `yaml:"mgmt,omitempty"`
// Authenticators provides configurations for Authenticating users
Authenticators auth.Lookup `yaml:"authenticators,omitempty"`
// Flags contains a compiled version of the CLI flags
Flags *Flags `yaml:"-"`
// Resources holds runtime resources uses by the Config
Resources *Resources `yaml:"-"`
CompiledRewriters rewriter.InstructionsLookup `yaml:"-"`
CompiledNegativeCaches negative.Lookups `yaml:"-"`
LoaderWarnings []string `yaml:"-"`
// contains filtered or unexported fields
}
Config is the main configuration object
func Load ¶
Load returns the Application Configuration, starting with a default config, then overriding with any provided config file, then env vars, and finally flags
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
func (*Config) IsStale ¶
IsStale returns true if the running config is stale versus the config on disk
func (*Config) OverlayYAMLData ¶
OverlayYAMLData extracts supported Config values from the yaml map, overlays the extracted values onto c.
type Flags ¶
type Flags struct {
PrintVersion bool
ValidateConfig bool
ProxyListenPort int
MetricsListenPort int
InstanceID int
ConfigPath string
Origin string
Provider string
LogLevel string
// contains filtered or unexported fields
}
Flags holds the values for whitelisted flags
type MainConfig ¶
type MainConfig struct {
// InstanceID represents a unique ID for the current instance, when multiple instances on the same host
InstanceID int `yaml:"instance_id,omitempty"`
// ServerName represents the server name that is conveyed in Via headers to upstream origins
// defaults to os.Hostname
ServerName string `yaml:"server_name,omitempty"`
// contains filtered or unexported fields
}
MainConfig is a collection of general configuration values.
func (*MainConfig) SetStalenessInfo ¶
func (mc *MainConfig) SetStalenessInfo(fp string, lm, rlt time.Time)