caddy/config/directives.go

46 lines
1.0 KiB
Go
Raw Normal View History

2015-01-14 03:43:45 +08:00
package config
import (
"github.com/mholt/caddy/config/parse"
"github.com/mholt/caddy/config/setup"
2015-03-26 23:52:03 +08:00
"github.com/mholt/caddy/middleware"
)
2015-01-14 03:43:45 +08:00
func init() {
// The parse package must know which directives
// are valid, but it must not import the setup
// or config package.
for _, dir := range directiveOrder {
parse.ValidDirectives[dir.name] = struct{}{}
}
}
2015-03-26 23:52:03 +08:00
var directiveOrder = []directive{
{"root", setup.Root},
{"tls", setup.TLS},
{"startup", setup.Startup},
{"shutdown", setup.Shutdown},
{"log", setup.Log},
{"gzip", setup.Gzip},
{"errors", setup.Errors},
{"header", setup.Headers},
{"rewrite", setup.Rewrite},
{"redir", setup.Redir},
{"ext", setup.Ext},
{"basicauth", setup.BasicAuth},
{"proxy", setup.Proxy},
{"fastcgi", setup.FastCGI},
// {"websocket", setup.WebSocket},
// {"markdown", setup.Markdown},
// {"templates", setup.Templates},
// {"browse", setup.Browse},
}
2015-03-26 23:52:03 +08:00
type directive struct {
name string
setup setupFunc
2015-01-14 03:43:45 +08:00
}
type setupFunc func(c *setup.Controller) (middleware.Middleware, error)