2016-06-21 15:01:46 +00:00
|
|
|
//go:generate go get github.com/jteeuwen/go-bindata
|
|
|
|
//go:generate go install github.com/jteeuwen/go-bindata/go-bindata
|
|
|
|
//go:generate go-bindata -pkg hugo -prefix "assets" -o binary.go assets/...
|
|
|
|
|
2016-02-14 10:14:28 +00:00
|
|
|
// Package hugo makes the bridge between the static website generator Hugo
|
|
|
|
// and the webserver Caddy, also providing an administrative user interface.
|
2015-10-16 18:34:27 +00:00
|
|
|
package hugo
|
2015-09-12 08:52:41 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2016-06-21 14:28:15 +00:00
|
|
|
"github.com/hacdias/caddy-filemanager"
|
2016-06-07 15:08:52 +00:00
|
|
|
"github.com/mholt/caddy/caddyhttp/httpserver"
|
2015-09-12 08:52:41 +00:00
|
|
|
)
|
|
|
|
|
2016-06-16 16:04:38 +00:00
|
|
|
// Hugo contais the next middleware to be run and the configuration
|
2016-02-14 10:14:28 +00:00
|
|
|
// of the current one.
|
2016-06-16 16:04:38 +00:00
|
|
|
type Hugo struct {
|
2016-06-21 14:28:15 +00:00
|
|
|
FileManager *filemanager.FileManager
|
|
|
|
Next httpserver.Handler
|
|
|
|
Config *Config
|
2015-09-20 08:15:21 +00:00
|
|
|
}
|
2015-09-12 08:52:41 +00:00
|
|
|
|
2016-02-14 10:14:28 +00:00
|
|
|
// ServeHTTP is the main function of the whole plugin that routes every single
|
|
|
|
// request to its function.
|
2016-06-16 16:04:38 +00:00
|
|
|
func (h Hugo) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
2015-09-13 11:14:18 +00:00
|
|
|
|
2015-09-13 21:48:52 +00:00
|
|
|
return h.Next.ServeHTTP(w, r)
|
2015-09-13 11:14:18 +00:00
|
|
|
}
|