Commit 051d2a68 authored by Matthew Holt's avatar Matthew Holt

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.
parent 7f7a6aba
package caddy package caddy
import ( import (
"bytes"
"fmt" "fmt"
"io" "io"
"log" "log"
...@@ -39,7 +40,11 @@ func loadConfigs(filename string, input io.Reader) ([]server.Config, error) { ...@@ -39,7 +40,11 @@ func loadConfigs(filename string, input io.Reader) ([]server.Config, error) {
return nil, err return nil, err
} }
if len(serverBlocks) == 0 { 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 var lastDirectiveIndex int // we set up directives in two parts; this stores where we left off
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment