mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-27 23:03:37 -05:00
Report errors when loading Caddyfile
This commit is contained in:
parent
c5aa5843d9
commit
c5524b0bab
1 changed files with 5 additions and 4 deletions
|
@ -271,13 +271,14 @@ func loadCaddyfileInput(serverType string) (Input, error) {
|
||||||
var loadedBy string
|
var loadedBy string
|
||||||
var caddyfileToUse Input
|
var caddyfileToUse Input
|
||||||
for _, l := range caddyfileLoaders {
|
for _, l := range caddyfileLoaders {
|
||||||
if cdyfile, err := l.loader.Load(serverType); cdyfile != nil {
|
cdyfile, err := l.loader.Load(serverType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("loading Caddyfile via %s: %v", l.name, err)
|
||||||
|
}
|
||||||
|
if cdyfile != nil {
|
||||||
if caddyfileToUse != nil {
|
if caddyfileToUse != nil {
|
||||||
return nil, fmt.Errorf("Caddyfile loaded multiple times; first by %s, then by %s", loadedBy, l.name)
|
return nil, fmt.Errorf("Caddyfile loaded multiple times; first by %s, then by %s", loadedBy, l.name)
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
loaderUsed = l
|
loaderUsed = l
|
||||||
caddyfileToUse = cdyfile
|
caddyfileToUse = cdyfile
|
||||||
loadedBy = l.name
|
loadedBy = l.name
|
||||||
|
|
Loading…
Add table
Reference in a new issue