config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBindAddress is the default address to bind to.
	DefaultBindAddress = ":8086"

	// DefaultFlightAddress is the default address to bind to.
	DefaultFlightAddress = ":8087"

	// DefaultRealm is the default realm sent back when issuing a basic auth challenge.
	DefaultRealm = "InfluxDB"

	// DefaultBindSocket is the default unix socket to bind to.
	DefaultBindSocket = "/var/run/tssql.sock"

	// DefaultMaxBodySize is the default maximum size of a client request body, in bytes. Specify 0 for no limit.
	DefaultMaxBodySize = 25e6

	// DefaultEnqueuedWriteTimeout is the maximum time a write request can wait to be processed.
	DefaultEnqueuedWriteTimeout = 30 * time.Second
	DefaultEnqueuedQueryTimeout = 5 * time.Minute
	// DefaultMaxRowNum is the maximum row number of a query result.
	DefaultMaxRowNum = 1000000

	DefaultBlockSize = 64 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BindAddress             string         `toml:"bind-address"`
	FlightAddress           string         `toml:"flight-address"`
	FlightEnabled           bool           `toml:"flight-enabled"`
	FlightAuthEnabled       bool           `toml:"flight-auth-enabled"`
	FlightChFactor          int            `toml:"flight-ch-factor"`
	Domain                  string         `toml:"domain"`
	AuthEnabled             bool           `toml:"auth-enabled"`
	WeakPwdPath             string         `toml:"weakpwd-path"`
	LogEnabled              bool           `toml:"log-enabled"`
	SuppressWriteLog        bool           `toml:"suppress-write-log"`
	WriteTracing            bool           `toml:"write-tracing"`
	FluxEnabled             bool           `toml:"flux-enabled"`
	FluxLogEnabled          bool           `toml:"flux-log-enabled"`
	PprofEnabled            bool           `toml:"pprof-enabled"`
	DebugPprofEnabled       bool           `toml:"debug-pprof-enabled"`
	HTTPSEnabled            bool           `toml:"https-enabled"`
	HTTPSCertificate        string         `toml:"https-certificate"`
	HTTPSPrivateKey         string         `toml:"https-private-key"`
	MaxRowLimit             int            `toml:"max-row-limit"`
	MaxConnectionLimit      int            `toml:"max-connection-limit"`
	SharedSecret            string         `toml:"shared-secret"`
	Realm                   string         `toml:"realm"`
	UnixSocketEnabled       bool           `toml:"unix-socket-enabled"`
	UnixSocketGroup         *toml.Group    `toml:"unix-socket-group"`
	UnixSocketPermissions   toml.FileMode  `toml:"unix-socket-permissions"`
	BindSocket              string         `toml:"bind-socket"`
	MaxBodySize             int            `toml:"max-body-size"`
	AccessLogPath           string         `toml:"access-log-path"`
	AccessLogStatusFilters  []StatusFilter `toml:"access-log-status-filters"`
	MaxConcurrentWriteLimit int            `toml:"max-concurrent-write-limit"`
	MaxEnqueuedWriteLimit   int            `toml:"max-enqueued-write-limit"`
	EnqueuedWriteTimeout    toml.Duration  `toml:"enqueued-write-timeout"`
	MaxConcurrentQueryLimit int            `toml:"max-concurrent-query-limit"`
	MaxEnqueuedQueryLimit   int            `toml:"max-enqueued-query-limit"`
	QueryRequestRateLimit   int            `toml:"query-request-ratelimit"`
	WriteRequestRateLimit   int            `toml:"write-request-ratelimit"`
	EnqueuedQueryTimeout    toml.Duration  `toml:"enqueued-query-timeout"`
	TLS                     *tls.Config    `toml:"-"`
	WhiteList               string         `toml:"white_list"`
	SlowQueryTime           toml.Duration  `toml:"slow-query-time"`
	ParallelQueryInBatch    bool           `toml:"parallel-query-in-batch-enabled"`
	QueryMemoryLimitEnabled bool           `toml:"query-memory-limit-enabled"`
	ChunkReaderParallel     int            `toml:"chunk-reader-parallel"`
	ReadBlockSize           toml.Size      `toml:"read-block-size"`
	TimeFilterProtection    bool           `toml:"time-filter-protection"`
	CPUThreshold            int            `toml:"cpu-threshold"`
}

Config represents a configuration for a HTTP service.

func NewConfig

func NewConfig() Config

NewHttpConfig returns a new Config with default settings.

func (*Config) ShowConfigs

func (c *Config) ShowConfigs() map[string]interface{}

func (Config) Validate

func (c Config) Validate() error

Validate validates that the configuration is acceptable.

type StatusFilter

type StatusFilter struct {
	// contains filtered or unexported fields
}

StatusFilter will check if an http status code matches a certain pattern.

func ParseStatusFilter

func ParseStatusFilter(s string) (StatusFilter, error)

ParseStatusFilter will create a new status filter from the string.

func (StatusFilter) MarshalText

func (sf StatusFilter) MarshalText() (text []byte, err error)

MarshalText converts a duration to a string for decoding toml

func (StatusFilter) Match

func (sf StatusFilter) Match(statusCode int) bool

Match will check if the status code matches this filter.

func (*StatusFilter) UnmarshalText

func (sf *StatusFilter) UnmarshalText(text []byte) error

UnmarshalText parses a TOML value into a duration value.

type StatusFilters

type StatusFilters []StatusFilter

func (StatusFilters) Match

func (filters StatusFilters) Match(statusCode int) bool

Jump to

Keyboard shortcuts

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