mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-06 22:40:31 -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
|
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) {
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue