diff options
author | Atakan Yenel <[email protected]> | 2024-11-05 17:35:32 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-11-05 09:35:32 -0700 |
commit | cc23ad6402e6dace30b04f0d9113530a4d9541a9 (patch) | |
tree | aea13a7b869e559fe846785bb7eb68297e367482 /modules/caddyhttp/fileserver/command.go | |
parent | 91e34139a17b8914a62669b275084b5d225e0624 (diff) | |
download | caddy-cc23ad6402e6dace30b04f0d9113530a4d9541a9.tar.gz caddy-cc23ad6402e6dace30b04f0d9113530a4d9541a9.zip |
fileserver: Add `file_limit` option for browse (to be experimental) (#6648)
* Add file_limit option for file_server browse
* Move file_limit inside browse.
* add file_server_file_limit caddyfile adapt test.
Diffstat (limited to 'modules/caddyhttp/fileserver/command.go')
-rw-r--r-- | modules/caddyhttp/fileserver/command.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/caddyhttp/fileserver/command.go b/modules/caddyhttp/fileserver/command.go index a76998405..a04d7cade 100644 --- a/modules/caddyhttp/fileserver/command.go +++ b/modules/caddyhttp/fileserver/command.go @@ -66,6 +66,7 @@ respond with a file listing.`, cmd.Flags().BoolP("templates", "t", false, "Enable template rendering") cmd.Flags().BoolP("access-log", "a", false, "Enable the access log") cmd.Flags().BoolP("debug", "v", false, "Enable verbose debug logs") + cmd.Flags().IntP("file-limit", "f", defaultDirEntryLimit, "Max directories to read") cmd.Flags().BoolP("no-compress", "", false, "Disable Zstandard and Gzip compression") cmd.Flags().StringSliceP("precompressed", "p", []string{}, "Specify precompression file extensions. Compression preference implied from flag order.") cmd.RunE = caddycmd.WrapCommandFuncForCobra(cmdFileServer) @@ -91,6 +92,7 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) { browse := fs.Bool("browse") templates := fs.Bool("templates") accessLog := fs.Bool("access-log") + fileLimit := fs.Int("file-limit") debug := fs.Bool("debug") revealSymlinks := fs.Bool("reveal-symlinks") compress := !fs.Bool("no-compress") @@ -151,7 +153,7 @@ func cmdFileServer(fs caddycmd.Flags) (int, error) { } if browse { - handler.Browse = &Browse{RevealSymlinks: revealSymlinks} + handler.Browse = &Browse{RevealSymlinks: revealSymlinks, FileLimit: fileLimit} } handlers = append(handlers, caddyconfig.JSONModuleObject(handler, "handler", "file_server", nil)) |