config

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminConfig

type AdminConfig struct {
	// BindAddr is the address to bind to listen for incoming HTTP connections.
	BindAddr string `json:"bind_addr" yaml:"bind_addr"`

	// AdvertiseAddr is the address to advertise to other nodes.
	AdvertiseAddr string `json:"advertise_addr" yaml:"advertise_addr"`

	Auth auth.Config `json:"auth" yaml:"auth"`

	TLS TLSConfig `json:"tls" yaml:"tls"`
}

func (*AdminConfig) RegisterFlags added in v0.3.0

func (c *AdminConfig) RegisterFlags(fs *pflag.FlagSet)

func (*AdminConfig) Validate

func (c *AdminConfig) Validate() error

type ClusterConfig

type ClusterConfig struct {
	// NodeID is a unique identifier for this node in the cluster.
	NodeID string `json:"node_id" yaml:"node_id"`

	// NodeIDPrefix is a node ID prefix, where Piko will generate the rest of
	// the node ID to ensure uniqueness.
	NodeIDPrefix string `json:"node_id_prefix" yaml:"node_id_prefix"`

	// Join contains a list of addresses of members in the cluster to join.
	Join []string `json:"join" yaml:"join"`

	// JoinTimeout is the time to keep trying to join the cluster before
	// failing.
	JoinTimeout time.Duration `json:"join_timeout" yaml:"join_timeout"`

	AbortIfJoinFails bool `json:"abort_if_join_fails" yaml:"abort_if_join_fails"`

	Gossip gossip.Config `json:"gossip" yaml:"gossip"`
}

func (*ClusterConfig) RegisterFlags added in v0.3.0

func (c *ClusterConfig) RegisterFlags(fs *pflag.FlagSet)

func (*ClusterConfig) Validate

func (c *ClusterConfig) Validate() error

type Config

type Config struct {
	Proxy ProxyConfig `json:"proxy" yaml:"proxy"`

	Upstream UpstreamConfig `json:"upstream" yaml:"upstream"`

	Admin AdminConfig `json:"admin" yaml:"admin"`

	Cluster ClusterConfig `json:"cluster" yaml:"cluster"`

	Usage UsageConfig `json:"usage" yaml:"usage"`

	Log log.Config `json:"log" yaml:"log"`

	// GracePeriod is the duration to gracefully shutdown the server. During
	// the grace period, listeners and idle connections are closed, then waits
	// for active requests to complete and closes their connections.
	GracePeriod time.Duration `json:"grace_period" yaml:"grace_period"`
}

func Default added in v0.6.0

func Default() *Config

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(fs *pflag.FlagSet)

func (*Config) Validate

func (c *Config) Validate() error

type HTTPConfig added in v0.3.0

type HTTPConfig struct {
	// ReadTimeout is the maximum duration for reading the entire
	// request, including the body. A zero or negative value means
	// there will be no timeout.
	ReadTimeout time.Duration `json:"read_timeout" yaml:"read_timeout"`

	// ReadHeaderTimeout is the amount of time allowed to read
	// request headers.
	ReadHeaderTimeout time.Duration `json:"read_header_timeout" yaml:"read_header_timeout"`

	// WriteTimeout is the maximum duration before timing out
	// writes of the response.
	WriteTimeout time.Duration `json:"write_timeout" yaml:"write_timeout"`

	// IdleTimeout is the maximum amount of time to wait for the
	// next request when keep-alives are enabled.
	IdleTimeout time.Duration `json:"idle_timeout" yaml:"idle_timeout"`

	// MaxHeaderBytes controls the maximum number of bytes the
	// server will read parsing the request header's keys and
	// values, including the request line.
	MaxHeaderBytes int `json:"max_header_bytes" yaml:"max_header_bytes"`
}

HTTPConfig contains generic configuration for the HTTP servers.

func (*HTTPConfig) RegisterFlags added in v0.3.0

func (c *HTTPConfig) RegisterFlags(fs *pflag.FlagSet, prefix string)

type ProxyConfig

type ProxyConfig struct {
	// BindAddr is the address to bind to listen for incoming HTTP connections.
	BindAddr string `json:"bind_addr" yaml:"bind_addr"`

	// AdvertiseAddr is the address to advertise to other nodes.
	AdvertiseAddr string `json:"advertise_addr" yaml:"advertise_addr"`

	// Timeout is the timeout to forward incoming requests to the upstream.
	Timeout time.Duration `json:"timeout" yaml:"timeout"`

	// AccessLog indicates whether to log all incoming connections and
	// requests.
	AccessLog bool `json:"access_log" yaml:"access_log"`

	Auth auth.Config `json:"auth" yaml:"auth"`

	HTTP HTTPConfig `json:"http" yaml:"http"`

	TLS TLSConfig `json:"tls" yaml:"tls"`
}

func (*ProxyConfig) RegisterFlags added in v0.2.0

func (c *ProxyConfig) RegisterFlags(fs *pflag.FlagSet)

func (*ProxyConfig) Validate

func (c *ProxyConfig) Validate() error

type TLSConfig added in v0.3.0

type TLSConfig struct {
	Cert      string `json:"cert" yaml:"cert"`
	Key       string `json:"key" yaml:"key"`
	ClientCAs string `json:"client_cas" yaml:"client_cas"`
}

func (*TLSConfig) Load added in v0.3.0

func (c *TLSConfig) Load() (*tls.Config, error)

func (*TLSConfig) RegisterFlags added in v0.3.0

func (c *TLSConfig) RegisterFlags(fs *pflag.FlagSet, prefix string)

func (*TLSConfig) Validate added in v0.3.0

func (c *TLSConfig) Validate() error

type UpstreamConfig

type UpstreamConfig struct {
	// BindAddr is the address to bind to listen for incoming HTTP connections.
	BindAddr string `json:"bind_addr" yaml:"bind_addr"`

	// AdvertiseAddr is the address to advertise to other nodes.
	AdvertiseAddr string `json:"advertise_addr" yaml:"advertise_addr"`

	Auth auth.Config `json:"auth" yaml:"auth"`

	TLS TLSConfig `json:"tls" yaml:"tls"`
}

func (*UpstreamConfig) RegisterFlags added in v0.3.0

func (c *UpstreamConfig) RegisterFlags(fs *pflag.FlagSet)

func (*UpstreamConfig) Validate

func (c *UpstreamConfig) Validate() error

type UsageConfig added in v0.2.0

type UsageConfig struct {
	// Disable indicates whether to disable anonymous usage collection.
	Disable bool `json:"disable" yaml:"disable"`
}

func (*UsageConfig) RegisterFlags added in v0.3.0

func (c *UsageConfig) RegisterFlags(fs *pflag.FlagSet)

Jump to

Keyboard shortcuts

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