(d *caddyfile.Dispenser)
| 87 | } |
| 88 | |
| 89 | func (f *moduleEntry) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { |
| 90 | for d.Next() { |
| 91 | // key required for now |
| 92 | if !d.Args(&f.Key) { |
| 93 | return d.ArgErr() |
| 94 | } |
| 95 | // get the module json |
| 96 | if !d.NextArg() { |
| 97 | return d.ArgErr() |
| 98 | } |
| 99 | name := d.Val() |
| 100 | modID := "caddy.fs." + name |
| 101 | unm, err := caddyfile.UnmarshalModule(d, modID) |
| 102 | if err != nil { |
| 103 | return err |
| 104 | } |
| 105 | fsys, ok := unm.(fs.FS) |
| 106 | if !ok { |
| 107 | return d.Errf("module %s (%T) is not a supported file system implementation (requires fs.FS)", modID, unm) |
| 108 | } |
| 109 | f.FileSystemRaw = caddyconfig.JSONModuleObject(fsys, "backend", name, nil) |
| 110 | } |
| 111 | return nil |
| 112 | } |
no test coverage detected