Documentation ¶
Index ¶
Constants ¶
View Source
const ( PluginName = "static" RootPluginName = "http" )
PluginName contains default service name.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Dir contains name of directory to control access to. // Default - "." Dir string `mapstructure:"dir"` // CalculateEtag can be true/false and used to calculate etag for the static CalculateEtag bool `mapstructure:"calculate_etag"` // Weak etag `W/` Weak bool `mapstructure:"weak"` // forbid specifies a list of file extensions which are forbidden for access. // example: .php, .exe, .bat, .htaccess etc. Forbid []string `mapstructure:"forbid"` // Allow specifies a list of file extensions which are allowed for access. // example: .php, .exe, .bat, .htaccess etc. Allow []string `mapstructure:"allow"` // Request headers to add to every static. Request map[string]string `mapstructure:"request"` // Response headers to add to every static. Response map[string]string `mapstructure:"response"` }
Config describes file location and controls access to them.
type Configurer ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin serves static files. Potentially convert into middleware?
func (*Plugin) Init ¶
func (s *Plugin) Init(cfg Configurer, log Logger) error
Init must return configure service and return true if the service hasStatus enabled. Must return error in case of misconfiguration. Services must not be used without proper configuration pushed first.
func (*Plugin) Middleware ¶
Middleware must return true if a request/response pair is handled within the middleware.
Click to show internal directories.
Click to hide internal directories.