diff options
| author | Shulhan <ms@kilabit.info> | 2024-04-01 05:02:24 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-04-03 02:12:58 +0700 |
| commit | f21ec39131b5fdaf5d9ff5e2921b6b2cf368f1e0 (patch) | |
| tree | 800669268e283106e180a807867cc859351f3cda | |
| parent | 86f47e2cdb2990b78c4c05074330237196d12f0e (diff) | |
| download | pakakeh.go-f21ec39131b5fdaf5d9ff5e2921b6b2cf368f1e0.tar.xz | |
cmd/httpdfs: set default include options to empty
By default httpdfs now serve all files under base directory.
| -rw-r--r-- | cmd/httpdfs/main.go | 7 |
1 files 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} } |
