Merge 07a21a8d5b2624eece752f68486f6a4189af830a into fd4de7e0ae4debd54e2a9a4aba10947cd4c3b178

This commit is contained in:
a 2025-02-20 12:03:02 -05:00 committed by GitHub
commit b3aaf5d54b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -289,7 +289,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["file_systems"] = caddyconfig.JSON(
filesystems,
&warnings)
}

View File

@ -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

View File

@ -20,13 +20,13 @@ func init() {
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
}
// 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: "caddy.filesystems",
ID: "file_systems",
New: func() caddy.Module { return new(Filesystems) },
}
}