mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
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.
This commit is contained in:
parent
7f7a6abafd
commit
051d2a68c0
1 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue