From 051d2a68c095c25bb216d17027922b7abf10e67a Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Wed, 4 Nov 2015 09:26:11 -0700 Subject: [PATCH] Fixed behavior with empty Caddyfile If the -host flag is used, we might still have to set up Let's Encrypt, so this change is necessary. --- caddy/config.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/caddy/config.go b/caddy/config.go index b7dfb146..3914290d 100644 --- a/caddy/config.go +++ b/caddy/config.go @@ -1,6 +1,7 @@ package caddy import ( + "bytes" "fmt" "io" "log" @@ -39,7 +40,11 @@ func loadConfigs(filename string, input io.Reader) ([]server.Config, error) { return nil, err } if len(serverBlocks) == 0 { - return []server.Config{NewDefault()}, nil + newInput := DefaultInput() + serverBlocks, err = parse.ServerBlocks(newInput.Path(), bytes.NewReader(newInput.Body()), true) + if err != nil { + return nil, err + } } var lastDirectiveIndex int // we set up directives in two parts; this stores where we left off