aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/caddyhttp/fileserver/caddyfile.go
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2019-08-21 15:50:02 -0600
committerMatthew Holt <[email protected]>2019-08-21 15:50:02 -0600
commitc0da7d487abcdcd9761220d75400f75584482b5f (patch)
tree2ea5f400a1c2bb58b8317d46f2e7f28006ee8351 /modules/caddyhttp/fileserver/caddyfile.go
parent8420a2f250cf467a06c0081cb47a8f73b70e7f3f (diff)
downloadcaddy-c0da7d487abcdcd9761220d75400f75584482b5f.tar.gz
caddy-c0da7d487abcdcd9761220d75400f75584482b5f.zip
file_server: Automatically hide all involved Caddyfiles
Diffstat (limited to 'modules/caddyhttp/fileserver/caddyfile.go')
-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 6fa94e7bf..902bd14c6 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
}