Merge branch 'configfix' into letsencrypt

Conflicts:
	config/config.go
This commit is contained in:
Matthew Holt
2015-10-16 11:40:44 -06:00
62 changed files with 1574 additions and 689 deletions

11
main.go
View File

@ -26,7 +26,7 @@ var (
func init() {
flag.StringVar(&conf, "conf", "", "Configuration file to use (default="+config.DefaultConfigFile+")")
flag.BoolVar(&app.Http2, "http2", true, "Enable HTTP/2 support") // TODO: temporary flag until http2 merged into std lib
flag.BoolVar(&app.HTTP2, "http2", true, "Enable HTTP/2 support") // TODO: temporary flag until http2 merged into std lib
flag.BoolVar(&app.Quiet, "quiet", false, "Quiet mode (no initialization output)")
flag.StringVar(&cpu, "cpu", "100%", "CPU cap")
flag.StringVar(&config.Root, "root", config.DefaultRoot, "Root path to default site")
@ -51,7 +51,7 @@ func main() {
log.Fatal(err)
}
// Load address configurations from highest priority input
// Load config from file
addresses, err := loadConfigs()
if err != nil {
log.Fatal(err)
@ -63,7 +63,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
s.HTTP2 = app.Http2 // TODO: This setting is temporary
s.HTTP2 = app.HTTP2 // TODO: This setting is temporary
app.Wg.Add(1)
go func(s *server.Server) {
defer app.Wg.Done()
@ -125,10 +125,9 @@ func isLocalhost(s string) bool {
// loadConfigs loads configuration from a file or stdin (piped).
// The configurations are grouped by bind address.
// Configuration is obtained from one of three sources, tried
// Configuration is obtained from one of four sources, tried
// in this order: 1. -conf flag, 2. stdin, 3. command line argument 4. Caddyfile.
// If none of those are available, a default configuration is
// loaded.
// If none of those are available, a default configuration is loaded.
func loadConfigs() (config.Group, error) {
// -conf flag
if conf != "" {