2015-01-13 14:43:45 -05:00
|
|
|
package config
|
|
|
|
|
2015-01-21 16:10:52 -05:00
|
|
|
import (
|
2015-05-04 07:53:54 -05:00
|
|
|
"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-21 16:10:52 -05:00
|
|
|
)
|
2015-01-19 01:11:21 -05:00
|
|
|
|
2015-01-13 14:43:45 -05:00
|
|
|
func init() {
|
2015-05-04 07:53:54 -05:00
|
|
|
// 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
|
|
|
|
2015-05-04 07:53:54 -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},
|
2015-05-04 12:04:17 -05:00
|
|
|
{"proxy", setup.Proxy},
|
|
|
|
{"fastcgi", setup.FastCGI},
|
2015-05-04 07:53:54 -05:00
|
|
|
// {"websocket", setup.WebSocket},
|
|
|
|
// {"markdown", setup.Markdown},
|
|
|
|
// {"templates", setup.Templates},
|
|
|
|
// {"browse", setup.Browse},
|
|
|
|
}
|
2015-03-26 10:52:03 -05:00
|
|
|
|
2015-05-04 07:53:54 -05:00
|
|
|
type directive struct {
|
|
|
|
name string
|
|
|
|
setup setupFunc
|
2015-01-13 14:43:45 -05:00
|
|
|
}
|
2015-05-04 07:53:54 -05:00
|
|
|
|
|
|
|
type setupFunc func(c *setup.Controller) (middleware.Middleware, error)
|