Migrate existing add-on names; set default root in SiteConfig

This commit is contained in:
Matthew Holt 2016-06-05 23:24:34 -06:00
parent a762dde145
commit ff22fbd79a
No known key found for this signature in database
GPG Key ID: 0D97CC73664F4D03
2 changed files with 18 additions and 8 deletions

View File

@ -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")

View File

@ -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 (