From ff22fbd79a74f15ccc8765655e25b60ab024dede Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Sun, 5 Jun 2016 23:24:34 -0600 Subject: [PATCH] Migrate existing add-on names; set default root in SiteConfig --- caddy/caddymain/run.go | 4 ++-- caddyhttp/httpserver/plugin.go | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/caddy/caddymain/run.go b/caddy/caddymain/run.go index e113330a..b1ae1859 100644 --- a/caddy/caddymain/run.go +++ b/caddy/caddymain/run.go @@ -33,11 +33,11 @@ func init() { flag.StringVar(&caddytls.DefaultCAUrl, "ca", "https://acme-staging.api.letsencrypt.org/directory", "URL to certificate authority's ACME server directory") flag.StringVar(&conf, "conf", "", "Caddyfile to load (default \""+caddy.DefaultConfigFile+"\")") flag.StringVar(&cpu, "cpu", "100%", "CPU cap") - flag.BoolVar(&plugins, "plugins", false, "List supported plugins") // TODO: change to plugins + flag.BoolVar(&plugins, "plugins", false, "List installed plugins") flag.StringVar(&caddytls.DefaultEmail, "email", "", "Default ACME CA account email address") flag.StringVar(&logfile, "log", "", "Process log file") flag.StringVar(&caddy.PidFile, "pidfile", "", "Path to write pid file") - flag.BoolVar(&caddy.Quiet, "quiet", false, "Quiet mode (no initialization output)") // TODO + flag.BoolVar(&caddy.Quiet, "quiet", false, "Quiet mode (no initialization output)") flag.StringVar(&revoke, "revoke", "", "Hostname for which to revoke the certificate") flag.StringVar(&serverType, "type", "http", "Type of server to run") flag.BoolVar(&version, "version", false, "Show version") diff --git a/caddyhttp/httpserver/plugin.go b/caddyhttp/httpserver/plugin.go index 3319a6b8..ac8b19fc 100644 --- a/caddyhttp/httpserver/plugin.go +++ b/caddyhttp/httpserver/plugin.go @@ -84,6 +84,7 @@ func (h *httpContext) InspectServerBlocks(sourceFile string, serverBlocks []cadd // Save the config to our master list, and key it for lookups cfg := &SiteConfig{ Addr: addr, + Root: Root, TLS: &caddytls.Config{Hostname: addr.Host}, HiddenFiles: []string{sourceFile}, } @@ -315,34 +316,43 @@ func standardizeAddress(str string) (Address, error) { // http server type, including non-standard (3rd-party) directives. // The ordering of this list is important. var directives = []string{ - // primitive actions that set up the basics of each config + // primitive actions that set up the fundamental vitals of each config "root", - "bind", "tls", + "bind", - // these don't inject middleware handlers + // services/utilities, or other directives that don't necessarily inject handlers "startup", "shutdown", + "realip", // github.com/captncraig/caddy-realip + "git", // github.com/abiosoft/caddy-git - // these add middleware to the stack + // directives that add middleware to the stack "log", "gzip", "errors", + "ipfilter", // github.com/pyed/ipfilter + "search", // github.com/pedronasser/caddy-search "header", + "cors", // github.com/captncraig/cors/caddy "rewrite", "redir", "ext", "mime", "basicauth", + "jwt", // github.com/BTBurke/caddy-jwt + "jsonp", // github.com/pschlump/caddy-jsonp + "upload", // blitznote.com/src/caddy.upload "internal", - "pprof", - "expvar", "proxy", "fastcgi", "websocket", "markdown", "templates", "browse", + "hugo", // github.com/hacdias/caddy-hugo + "mailout", // github.com/SchumacherFM/mailout + "prometheus", // github.com/miekg/caddy-prometheus } const (