Documentation
¶
Index ¶
Constants ¶
View Source
const PluginName = "static"
PluginName contains default service name.
View Source
const RootPluginName = "http"
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 list of file extensions which are forbidden for access.
// example: .php, .exe, .bat, .htaccess and etc.
Forbid []string `mapstructure:"forbid"`
// Allow specifies list of file extensions which are allowed for access.
// example: .php, .exe, .bat, .htaccess and 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 Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin serves static files. Potentially convert into middleware?
func (*Plugin) Init ¶
Init must return configure service and return true if 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 request/response pair is handled within the middleware.
Click to show internal directories.
Click to hide internal directories.