summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-08-21 15:50:02 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-08-21 15:50:02 -0600
commitc0da7d487abcdcd9761220d75400f75584482b5f (patch)
tree2ea5f400a1c2bb58b8317d46f2e7f28006ee8351 /modules
parent8420a2f250cf467a06c0081cb47a8f73b70e7f3f (diff)
file_server: Automatically hide all involved Caddyfiles
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/fileserver/caddyfile.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/caddyhttp/fileserver/caddyfile.go b/modules/caddyhttp/fileserver/caddyfile.go
index 6fa94e7..902bd14 100644
--- a/modules/caddyhttp/fileserver/caddyfile.go
+++ b/modules/caddyhttp/fileserver/caddyfile.go
@@ -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
}