Documentation ¶
Index ¶
Constants ¶
const ( DefaultListen = ":8080" DefaultServerName = "fasthttpd" )
Default values.
const ( MatchPrefix = "prefix" MatchEqual = "equal" MatchRegexp = "regexp" )
Supported Route.Match values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessLog ¶
type AccessLog struct { Output string `yaml:"output"` Format string `yaml:"format"` QueueSize int `yaml:"queueSize"` Rotation Rotation }
AccessLog represents a configuration of access log.
func (AccessLog) SetDefaults ¶ added in v0.1.0
SetDefaults sets default values.
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"` Include string `yaml:"include"` }
Config represents a configuration root of fasthttpd. If Include is not empty, other keys are ignored.
func UnmarshalYAML ¶
UnmarshalYAML decodes data as multi Config YAML documents.
func UnmarshalYAMLPath ¶
UnmarshalYAMLPath decodes path as multi Config YAML documents file.
func (Config) SetDefaults ¶ added in v0.1.0
SetDefaults sets default values.
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
SetDefaults sets default values.
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
SetDefaults sets default values.
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"` NextIfNotFound bool `yaml:"nextIfNotFound"` }
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"` AutoCert bool `yaml:"autoCert"` AutoCertCacheDir string `yaml:"autoCertCacheDir"` }
SSL represents a configuration of SSL. If AutoCert is true, CertFile and KeyFile are ignored.
func (SSL) SetDefaults ¶ added in v0.3.6
SetDefaults sets default values.