config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultListen     = ":8800"
	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
}

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"`
	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
}

func (Log) SetDefaults added in v0.1.0

func (l Log) SetDefaults() Log

type Rewrite

type Rewrite struct {
	URI               string `yaml:"uri"`
	AppendQueryString bool   `yaml:"appendQueryString"`
}

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"`
}

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 Rewrite  `yaml:"rewrite"`
	Handler string   `yaml:"handler"`
	Status  Status   `yaml:"status"`
}

type RoutesCache

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

type Status

type Status struct {
	Code    int    `yaml:"code"`
	Message string `yaml:"message"`
}

Jump to

Keyboard shortcuts

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