filebrowser/setup.go

30 lines
493 B
Go
Raw Normal View History

2016-06-10 13:36:43 +00:00
package filemanager
import (
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
func init() {
caddy.RegisterPlugin("filemanager", caddy.Plugin{
ServerType: "http",
Action: setup,
})
}
// setup configures the middlware.
func setup(c *caddy.Controller) error {
cnf := httpserver.GetConfig(c.Key)
// parse config
mid := func(next httpserver.Handler) httpserver.Handler {
return FileManager{
Next: next,
}
}
cnf.AddMiddleware(mid)
return nil
}