0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00
caddy/config/directives.go

46 lines
1 KiB
Go
Raw Normal View History

2015-01-13 14:43:45 -05:00
package config
import (
"github.com/mholt/caddy/config/parse"
"github.com/mholt/caddy/config/setup"
2015-03-26 10:52:03 -05:00
"github.com/mholt/caddy/middleware"
)
2015-01-13 14:43:45 -05: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 10:52:03 -05: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 10:52:03 -05:00
type directive struct {
name string
setup setupFunc
2015-01-13 14:43:45 -05:00
}
type setupFunc func(c *setup.Controller) (middleware.Middleware, error)