0
Fork 0
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:
Matthew Holt 2016-08-17 17:02:01 -06:00
parent c5aa5843d9
commit c5524b0bab
No known key found for this signature in database
GPG key ID: 0D97CC73664F4D03

View file

@ -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