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

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(&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(&conf, "conf", "", "Caddyfile to load (default \""+caddy.DefaultConfigFile+"\")")
flag.StringVar(&cpu, "cpu", "100%", "CPU cap") 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(&caddytls.DefaultEmail, "email", "", "Default ACME CA account email address")
flag.StringVar(&logfile, "log", "", "Process log file") flag.StringVar(&logfile, "log", "", "Process log file")
flag.StringVar(&caddy.PidFile, "pidfile", "", "Path to write pid 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(&revoke, "revoke", "", "Hostname for which to revoke the certificate")
flag.StringVar(&serverType, "type", "http", "Type of server to run") flag.StringVar(&serverType, "type", "http", "Type of server to run")
flag.BoolVar(&version, "version", false, "Show version") 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 // Save the config to our master list, and key it for lookups
cfg := &SiteConfig{ cfg := &SiteConfig{
Addr: addr, Addr: addr,
Root: Root,
TLS: &caddytls.Config{Hostname: addr.Host}, TLS: &caddytls.Config{Hostname: addr.Host},
HiddenFiles: []string{sourceFile}, HiddenFiles: []string{sourceFile},
} }
@ -315,34 +316,43 @@ func standardizeAddress(str string) (Address, error) {
// http server type, including non-standard (3rd-party) directives. // http server type, including non-standard (3rd-party) directives.
// The ordering of this list is important. // The ordering of this list is important.
var directives = []string{ 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", "root",
"bind",
"tls", "tls",
"bind",
// these don't inject middleware handlers // services/utilities, or other directives that don't necessarily inject handlers
"startup", "startup",
"shutdown", "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", "log",
"gzip", "gzip",
"errors", "errors",
"ipfilter", // github.com/pyed/ipfilter
"search", // github.com/pedronasser/caddy-search
"header", "header",
"cors", // github.com/captncraig/cors/caddy
"rewrite", "rewrite",
"redir", "redir",
"ext", "ext",
"mime", "mime",
"basicauth", "basicauth",
"jwt", // github.com/BTBurke/caddy-jwt
"jsonp", // github.com/pschlump/caddy-jsonp
"upload", // blitznote.com/src/caddy.upload
"internal", "internal",
"pprof",
"expvar",
"proxy", "proxy",
"fastcgi", "fastcgi",
"websocket", "websocket",
"markdown", "markdown",
"templates", "templates",
"browse", "browse",
"hugo", // github.com/hacdias/caddy-hugo
"mailout", // github.com/SchumacherFM/mailout
"prometheus", // github.com/miekg/caddy-prometheus
} }
const ( const (