file_server: Automatically hide all involved Caddyfiles

This commit is contained in:
Matthew Holt
2019-08-21 15:50:02 -06:00
parent 8420a2f250
commit c0da7d487a
3 changed files with 30 additions and 0 deletions
@@ -76,6 +76,15 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
fsrv.Root = "{http.var.root}"
}
// hide the Caddyfile (and any imported Caddyfiles)
if configFiles := h.Caddyfiles(); len(configFiles) > 0 {
for _, file := range configFiles {
if !fileHidden(file, fsrv.Hide) {
fsrv.Hide = append(fsrv.Hide, file)
}
}
}
return &fsrv, nil
}