Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config defines the configuration structures for the HTTP plugin, covering server addresses, TLS, FastCGI, HTTP2/3, upload handling, and worker pool settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// RawBody if turned on, RR will not parse the incoming HTTP body and will send it as is
	RawBody bool `mapstructure:"raw_body"`
	// Host and port to handle as http server.
	Address string `mapstructure:"address"`
	// UnixSocket sets attributes on the plain HTTP UNIX socket only.
	UnixSocket *tcplisten.UnixSocketOptions `mapstructure:"unix_socket"`
	// ProxyProtocol applies only to the plain HTTP listener.
	ProxyProtocol *proxyprotocol.Config `mapstructure:"proxy_protocol"`
	// AccessLogs turn on/off, logged at Info log level, default: false
	AccessLogs bool `mapstructure:"access_logs"`
	// List of the middleware names (order will be preserved)
	Middleware []string `mapstructure:"middleware"`
	// Pool configures worker pool.
	Pool *pool.Config `mapstructure:"pool"`
	// InternalErrorCode used to override default 500 (InternalServerError) http code
	InternalErrorCode uint64 `mapstructure:"internal_error_code"`
	// MaxRequestSize specified max size for payload body in megabytes. 0 = 1GB.
	MaxRequestSize uint64 `mapstructure:"max_request_size"`
	// SSLConfig defines https server options.
	SSLConfig *https.SSL `mapstructure:"ssl"`
	// FCGIConfig configuration. You can use FastCGI without HTTP server.
	FCGIConfig *fcgi.FCGI `mapstructure:"fcgi"`
	// HTTP2Config configuration
	HTTP2Config *https.HTTP2  `mapstructure:"http2"`
	HTTP3Config *http3.Config `mapstructure:"http3"`
	// Uploads configures uploads configuration.
	Uploads *Uploads `mapstructure:"uploads"`

	// private
	UID int
	GID int
}

Config configures RoadRunner HTTP server.

func (*Config) EnableFCGI

func (c *Config) EnableFCGI() bool

EnableFCGI is true when FastCGI server must be enabled.

func (*Config) EnableHTTP

func (c *Config) EnableHTTP() bool

EnableHTTP is true when http server must run.

func (*Config) EnableHTTP3

func (c *Config) EnableHTTP3() bool

EnableHTTP3 is true when http server must run.

func (*Config) EnableTLS

func (c *Config) EnableTLS() bool

EnableTLS returns true if pool must listen TLS connections.

func (*Config) InitDefaults

func (c *Config) InitDefaults() error

InitDefaults must populate HTTP values using given HTTP source. Must return error if HTTP is not valid.

func (*Config) Valid

func (c *Config) Valid() error

Valid validates the configuration.

type Uploads

type Uploads struct {
	// Dir contains name of directory to control access to.
	Dir string `mapstructure:"dir"`

	// Forbid specifies list of file extensions which are forbidden for access.
	// Example: .php, .exe, .bat, .htaccess and etc.
	Forbid []string `mapstructure:"forbid"`

	// Allowed files
	Allow []string `mapstructure:"allow"`

	// internal
	Forbidden map[string]struct{} `mapstructure:"-"`
	Allowed   map[string]struct{} `mapstructure:"-"`
}

Uploads describes file location and controls access to them.

func (*Uploads) InitDefaults

func (cfg *Uploads) InitDefaults() error

InitDefaults sets missing values to their default values.

Jump to

Keyboard shortcuts

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