From f21ec39131b5fdaf5d9ff5e2921b6b2cf368f1e0 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Mon, 1 Apr 2024 05:02:24 +0700 Subject: cmd/httpdfs: set default include options to empty By default httpdfs now serve all files under base directory. --- cmd/httpdfs/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/httpdfs/main.go b/cmd/httpdfs/main.go index 41549ddd..92b32650 100644 --- a/cmd/httpdfs/main.go +++ b/cmd/httpdfs/main.go @@ -20,7 +20,6 @@ import ( const ( defAddress = `127.0.0.1:28194` - defInclude = `.*\.(css|html|ico|js|jpg|png|svg)$` ) func main() { @@ -36,7 +35,7 @@ func main() { flag.StringVar(&flagAddress, `address`, defAddress, `Listen address`) flag.StringVar(&flagExclude, `exclude`, ``, `Regex to exclude files in base directory`) flag.BoolVar(&flagHelp, `help`, false, `Print the command usage`) - flag.StringVar(&flagInclude, `include`, defInclude, `Regex to include files in base directory`) + flag.StringVar(&flagInclude, `include`, ``, `Regex to include files in base directory`) flag.BoolVar(&flagVersion, `version`, false, `Print the program version`) flag.Parse() @@ -66,12 +65,14 @@ func main() { var ( mfsOpts = memfs.Options{ Root: dirBase, - Includes: []string{flagInclude}, MaxFileSize: -1, TryDirect: true, } mfs *memfs.MemFS ) + if len(flagInclude) != 0 { + mfsOpts.Includes = []string{flagInclude} + } if len(flagExclude) != 0 { mfsOpts.Excludes = []string{flagExclude} } -- cgit v1.3