config

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Log          *LogConfig               `json:",omitempty"`
	HTTPServers  HTTPServersConfig        `json:"HTTP"`
	Handlers     HandlersConfig           `json:"Handlers"`
	Metrics      *MetricsConfig           `json:",omitempty"`
	SNI          *jconf.OptionalSubConfig `json:"SNI,omitempty"` // a special backwards compatible option
	TLSPlugins   TLSPluginsConfig         `json:",omitempty"`
	TLSPluginDir string                   `json:",omitempty"`
}

Config defined JSON for the top level server config

func ParseConfigFromFile

func ParseConfigFromFile(filename string) (*Config, error)

ParseConfigFromFile returns a pointer to a new Config object after parsing config file content.

func ParseConfigFromReadSeeker

func ParseConfigFromReadSeeker(data io.ReadSeeker) (*Config, error)

ParseConfigFromReadSeeker returns a pointer to a new Config object. The config is read from a in memory buffer.

func (*Config) Dump

func (cfg *Config) Dump(dest io.Writer)

Dump serialized the JSON config as configured to standard output

type ConfigError

type ConfigError error

func WrapError

func WrapError(wrapped error) ConfigError

type HTTPServerConfig

type HTTPServerConfig struct {
	Listeners map[string]ListenerConfig

	// either string, or map (for a mux) or "404" for NotFound
	Handler *jconf.MandatorySubConfig

	// overrides the global Accesslog definition
	AccessLog string

	// a , separated string of return code specs: "2XX,412,5XX,404"
	Metrics string

	DisableKeepAlives bool

	ReadHeaderTimeout jconf.Duration
	IdleTimeout       jconf.Duration
	ReadTimeout       jconf.Duration
	WriteTimeout      jconf.Duration

	NewActiveTimeout jconf.Duration
}

HTTPServerConfig defines the JSON to configure a HTTP server.

type HTTPServersConfig

type HTTPServersConfig map[string]HTTPServerConfig

type HandlerConfig

type HandlerConfig struct {
	Type    string
	Plugin  string
	Metrics string                   `json:",omitempty"`
	Config  *jconf.OptionalSubConfig `json:",omitempty"`
}

HandlerConfig specifies the type and config for a handler. Potentiall found in a plugin. All handlers can be wrapped in metrics spec specific for them.

type HandlersConfig

type HandlersConfig map[string]HandlerConfig

type ListenerConfig

type ListenerConfig struct {
	Address           string
	Port              int
	IOActivityTimeout jconf.Duration   `json:",omitempty"`
	TLS               *TLSServerConfig `json:",omitempty"`
	SocketFdName      string           `json:",omitempty"`
	SocketInheritOnly bool             `json:",omitempty"`
}

ListenerConfig defined the JSON used to configure a listener.

type LogConfig

type LogConfig struct {
	AccessLog string
}

type MetricsConfig

type MetricsConfig struct {
	Address     string
	Interval    jconf.Duration
	Prefix      string
	Application string
	Ident       string
}

MetricsConfig is the global configuration for a statsd server.

type RedirectHandlerConfig

type RedirectHandlerConfig struct {
	Code int
	URL  string
}

RedirectHandlerConfig is configuration for a 30X redirect handler

type TLSPluginConfig

type TLSPluginConfig struct {
	Type   string
	Plugin string
	Config *jconf.OptionalSubConfig `json:",omitempty"`
}

TLSPluginConfig defines configuration for loading and configuring a TLS plugin

type TLSPluginsConfig

type TLSPluginsConfig map[string]TLSPluginConfig

type TLSServerConfig

type TLSServerConfig struct {
	tlsconf.TLSServerConfig
	EnableExternalSNI bool // backward compatible - use "" as pluginname
	TLSPlugin         string
}

TLSServerConfig defines JSON for a server TLS configuration including a callback to augment the *tls.Config.

Jump to

Keyboard shortcuts

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