From 06ed6fcf99e603a942972ea1c9e91ef48e741db1 Mon Sep 17 00:00:00 2001 From: a Date: Sun, 21 Jul 2024 13:19:23 -0500 Subject: [PATCH 1/5] change name --- caddyconfig/httpcaddyfile/httptype.go | 2 +- modules/caddyfs/filesystem.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index a8a2ae5b3c5..5d8190c3424 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -275,7 +275,7 @@ func (st ServerType) Setup( cfg.AppsRaw["pki"] = caddyconfig.JSON(pkiApp, &warnings) } if filesystems, ok := options["filesystem"].(caddy.Module); ok { - cfg.AppsRaw["caddy.filesystems"] = caddyconfig.JSON( + cfg.AppsRaw["filesystems"] = caddyconfig.JSON( filesystems, &warnings) } diff --git a/modules/caddyfs/filesystem.go b/modules/caddyfs/filesystem.go index b2fdcf7a274..069949fa50c 100644 --- a/modules/caddyfs/filesystem.go +++ b/modules/caddyfs/filesystem.go @@ -49,7 +49,7 @@ func parseFilesystems(d *caddyfile.Dispenser, existingVal any) (any, error) { // CaddyModule returns the Caddy module information. func (Filesystems) CaddyModule() caddy.ModuleInfo { return caddy.ModuleInfo{ - ID: "caddy.filesystems", + ID: "filesystems", New: func() caddy.Module { return new(Filesystems) }, } } From 6e3abf388e40fdca84798e79d7913733d2c61b52 Mon Sep 17 00:00:00 2001 From: a Date: Sun, 21 Jul 2024 13:29:04 -0500 Subject: [PATCH 2/5] unwrap --- internal/filesystems/map.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/filesystems/map.go b/internal/filesystems/map.go index e795ed1fec1..1e693d464be 100644 --- a/internal/filesystems/map.go +++ b/internal/filesystems/map.go @@ -18,6 +18,10 @@ type wrapperFs struct { fs.FS } +func (w *wrapperFs) Unwrap() fs.FS { + return w.FS +} + // FilesystemMap stores a map of filesystems // the empty key will be overwritten to be the default key // it includes a default filesystem, based off the os fs From 447066e7c2c5b0e792a0f1cfac8991e40213c366 Mon Sep 17 00:00:00 2001 From: a Date: Tue, 17 Sep 2024 16:28:33 -0500 Subject: [PATCH 3/5] noot --- caddyconfig/httpcaddyfile/httptype.go | 4 ++-- modules/caddyfs/filesystem.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index 5d8190c3424..5089caef758 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -274,8 +274,8 @@ func (st ServerType) Setup( if !reflect.DeepEqual(pkiApp, &caddypki.PKI{CAs: make(map[string]*caddypki.CA)}) { cfg.AppsRaw["pki"] = caddyconfig.JSON(pkiApp, &warnings) } - if filesystems, ok := options["filesystem"].(caddy.Module); ok { - cfg.AppsRaw["filesystems"] = caddyconfig.JSON( + if filesystems, ok := options["file_systems"].(caddy.Module); ok { + cfg.AppsRaw["file_systems"] = caddyconfig.JSON( filesystems, &warnings) } diff --git a/modules/caddyfs/filesystem.go b/modules/caddyfs/filesystem.go index 069949fa50c..fdb9e781517 100644 --- a/modules/caddyfs/filesystem.go +++ b/modules/caddyfs/filesystem.go @@ -15,7 +15,7 @@ import ( func init() { caddy.RegisterModule(Filesystems{}) - httpcaddyfile.RegisterGlobalOption("filesystem", parseFilesystems) + httpcaddyfile.RegisterGlobalOption("file_systems", parseFilesystems) } type moduleEntry struct { @@ -26,7 +26,7 @@ type moduleEntry struct { // Filesystems loads caddy.fs modules into the global filesystem map type Filesystems struct { - Filesystems []*moduleEntry `json:"filesystems"` + Filesystems []*moduleEntry `json:"file_systems"` defers []func() } @@ -49,7 +49,7 @@ func parseFilesystems(d *caddyfile.Dispenser, existingVal any) (any, error) { // CaddyModule returns the Caddy module information. func (Filesystems) CaddyModule() caddy.ModuleInfo { return caddy.ModuleInfo{ - ID: "filesystems", + ID: "file_systems", New: func() caddy.Module { return new(Filesystems) }, } } From 98ad0a1fd2c50fa0f0efdbd3b4e056c9a8430cd8 Mon Sep 17 00:00:00 2001 From: a Date: Tue, 17 Sep 2024 16:46:56 -0500 Subject: [PATCH 4/5] noot --- caddyconfig/httpcaddyfile/httptype.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index 5089caef758..7ccabe7fe43 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -274,7 +274,7 @@ func (st ServerType) Setup( if !reflect.DeepEqual(pkiApp, &caddypki.PKI{CAs: make(map[string]*caddypki.CA)}) { cfg.AppsRaw["pki"] = caddyconfig.JSON(pkiApp, &warnings) } - if filesystems, ok := options["file_systems"].(caddy.Module); ok { + if filesystems, ok := options["filesystem"].(caddy.Module); ok { cfg.AppsRaw["file_systems"] = caddyconfig.JSON( filesystems, &warnings) From 07a21a8d5b2624eece752f68486f6a4189af830a Mon Sep 17 00:00:00 2001 From: a Date: Tue, 17 Sep 2024 17:08:13 -0500 Subject: [PATCH 5/5] noot --- modules/caddyfs/filesystem.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/caddyfs/filesystem.go b/modules/caddyfs/filesystem.go index fdb9e781517..12be82e9498 100644 --- a/modules/caddyfs/filesystem.go +++ b/modules/caddyfs/filesystem.go @@ -15,12 +15,12 @@ import ( func init() { caddy.RegisterModule(Filesystems{}) - httpcaddyfile.RegisterGlobalOption("file_systems", parseFilesystems) + httpcaddyfile.RegisterGlobalOption("filesystem", parseFilesystems) } type moduleEntry struct { Key string `json:"name,omitempty"` - FileSystemRaw json.RawMessage `json:"file_system,omitempty" caddy:"namespace=caddy.fs inline_key=backend"` + FileSystemRaw json.RawMessage `json:"filesystem,omitempty" caddy:"namespace=caddy.fs inline_key=backend"` fileSystem fs.FS }