config

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultListen     = ":8080"
	DefaultServerName = "fasthttpd"
	MatchPrefix       = "prefix"
	MatchEqual        = "equal"
	MatchRegexp       = "regexp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLog

type AccessLog struct {
	Output   string `yaml:"output"`
	Format   string `yaml:"format"`
	Rotation Rotation
}

AccessLog represents a configuration of access log.

func (AccessLog) SetDefaults added in v0.1.0

func (l AccessLog) SetDefaults() AccessLog

type Config

type Config struct {
	Host        string              `yaml:"host"`
	Listen      string              `yaml:"listen"`
	SSL         SSL                 `yaml:"ssl"`
	Root        string              `yaml:"root"`
	Server      tree.Map            `yaml:"server"`
	Log         Log                 `yaml:"log"`
	AccessLog   AccessLog           `yaml:"accessLog"`
	ErrorPages  map[string]string   `yaml:"errorPages"`
	Filters     map[string]tree.Map `yaml:"filters"`
	Handlers    map[string]tree.Map `yaml:"handlers"`
	Routes      []Route             `yaml:"routes"`
	RoutesCache RoutesCache         `yaml:"routesCache"`
}

Config represents a configuration root of fasthttpd.

func UnmarshalYAML

func UnmarshalYAML(data []byte) ([]Config, error)

func UnmarshalYAMLPath

func UnmarshalYAMLPath(path string) ([]Config, error)

func (Config) Normalize

func (cfg Config) Normalize() (Config, error)

func (Config) SetDefaults added in v0.1.0

func (cfg Config) SetDefaults() Config

type Log

type Log struct {
	Output   string   `yaml:"output"`
	Prefix   string   `yaml:"prefix"`
	Flags    []string `yaml:"flags"`
	Rotation Rotation
}

Log represents a configuration of logging.

func (Log) SetDefaults added in v0.1.0

func (l Log) SetDefaults() Log

type Rotation added in v0.1.0

type Rotation struct {
	MaxSize    int  `yaml:"maxSize"`
	MaxBackups int  `yaml:"maxBackups"`
	MaxAge     int  `yaml:"maxAge"`
	Compress   bool `yaml:"compress"`
	LocalTime  bool `yaml:"localTime"`
}

Rotation represents a configuration of log rotation.

func (Rotation) SetDefaults added in v0.1.0

func (r Rotation) SetDefaults() Rotation

type Route

type Route struct {
	Path                     string   `yaml:"path"`
	Match                    string   `yaml:"match"`
	Methods                  []string `yaml:"methods"`
	Filters                  []string `yaml:"filters"`
	Rewrite                  string   `yaml:"rewrite"`
	RewriteAppendQueryString bool     `yaml:"rewriteAppendQueryString"`
	Handler                  string   `yaml:"handler"`
	Status                   int      `yaml:"status"`
	StatusMessage            string   `yaml:"statusMessage"`
}

Route represents a configuration of route.

type RoutesCache

type RoutesCache struct {
	Enable   bool `yaml:"enable"`
	Expire   int  `yaml:"expire"`
	Interval int  `yaml:"interval"`
}

RoutesCache represents a configuration of route cache.

type SSL added in v0.2.0

type SSL struct {
	CertFile string `yaml:"certFile"`
	KeyFile  string `yaml:"keyFile"`
}

SSL represents a configuration of SSL.

Jump to

Keyboard shortcuts

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