config

package
v1.51.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendConfig

type BackendConfig struct {
	ClientAuthCertificate *tls.Certificate `yaml:"-"`
	MaxConns              int64            `yaml:"max_conns"`

	TLSPem `yaml:",inline"` // embed to get cert_chain and private_key for client authentication
}

type ClientTLS

type ClientTLS struct {
	CA                 string `yaml:"ca,omitempty"`
	Cert               string `yaml:"cert,omitempty"`
	Key                string `yaml:"key,omitempty"`
	InsecureSkipVerify bool   `yaml:"skip_ssl_validation"`
}

type Config

type Config struct {
	ConsulConfig      ConsulConfig    `yaml:"consul,omitempty"`
	Logging           Log             `yaml:"logging,omitempty"`
	Port              uint16          `yaml:"port,omitempty"`
	HealthCheckPort   uint16          `yaml:"health_check_port,omitempty"`
	EnableSSL         bool            `yaml:"enable_ssl,omitempty"`
	SSLCertificate    tls.Certificate `yaml:"-"`
	TLSPEM            TLSPem          `yaml:"tls_pem,omitempty"`
	CACerts           string          `yaml:"ca_certs,omitempty"`
	CAPool            *x509.CertPool  `yaml:"-"`
	SkipSSLValidation bool            `yaml:"skip_ssl_validation,omitempty"`

	Backends BackendConfig `yaml:"backends,omitempty"`

	DisableKeepAlives   bool `yaml:"disable_keep_alives"`
	MaxIdleConns        int  `yaml:"max_idle_conns,omitempty"`
	MaxIdleConnsPerHost int  `yaml:"max_idle_conns_per_host,omitempty"`

	BaseURL string `yaml:"base_url"`

	ExternalExporters ExternalExporters `yaml:"external_exporters"`
}

func DefaultConfig

func DefaultConfig() (*Config, error)

func InitConfigFromFile

func InitConfigFromFile(file *os.File) (*Config, error)

func (*Config) Initialize

func (c *Config) Initialize(configYAML []byte) error

func (*Config) Process

func (c *Config) Process() error

type ConsulConfig

type ConsulConfig struct {
	Address          string                  `yaml:"address"`
	Scheme           string                  `yaml:"scheme"`
	DataCenter       string                  `yaml:"datacenter"`
	Token            string                  `yaml:"token"`
	TLS              *ClientTLS              `yaml:"tls"`
	HTTPAuth         *EndpointHTTPAuthConfig `yaml:"http_auth"`
	EndpointWaitTime yamlTimeDur             `yaml:"endpoint_wait_time"`
}

type EndpointHTTPAuthConfig

type EndpointHTTPAuthConfig struct {
	Username string `yaml:"username,omitempty"`
	Password string `yaml:"password,omitempty"`
}

type ExternalExporter

type ExternalExporter struct {
	Name        string                     `yaml:"name"`
	Host        string                     `yaml:"host"`
	MetricsPath string                     `yaml:"metrics_path"`
	Scheme      string                     `yaml:"scheme"`
	Params      map[string][]ValueTemplate `yaml:"params"`
	IsTls       bool                       `yaml:"-"`
}

func (*ExternalExporter) ParamsToURLValues

func (ee *ExternalExporter) ParamsToURLValues(route *models.Route) (url.Values, error)

func (*ExternalExporter) ToRoute

func (ee *ExternalExporter) ToRoute(route *models.Route) (*models.Route, error)

func (*ExternalExporter) UnmarshalYAML

func (ee *ExternalExporter) UnmarshalYAML(unmarshal func(interface{}) error) error

type ExternalExporters

type ExternalExporters []*ExternalExporter

type Log

type Log struct {
	Level   string `yaml:"level"`
	NoColor bool   `yaml:"no_color"`
	InJson  bool   `yaml:"in_json"`
}

func (*Log) UnmarshalYAML

func (c *Log) UnmarshalYAML(unmarshal func(interface{}) error) error

type TLSPem

type TLSPem struct {
	CertChain  string `yaml:"cert_chain"`
	PrivateKey string `yaml:"private_key"`
}

type ValueTemplate

type ValueTemplate struct {
	Raw string
	// contains filtered or unexported fields
}

func (*ValueTemplate) ResolveTags

func (vt *ValueTemplate) ResolveTags(route *models.Route) (string, error)

func (*ValueTemplate) UnmarshalYAML

func (vt *ValueTemplate) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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