MCPcopy Create free account
hub / github.com/foxcpp/maddy / Configure

Method Configure

internal/storage/blob/fs/fs.go:34–57  ·  view source on GitHub ↗
(inlineArgs []string, cfg *config.Map)

Source from the content-addressed store, hash-verified

32}
33
34func (s *FSStore) Configure(inlineArgs []string, cfg *config.Map) error {
35 switch len(inlineArgs) {
36 case 0:
37 case 1:
38 s.root = inlineArgs[0]
39 default:
40 return fmt.Errorf("storage.blob.fs: 1 or 0 arguments expected")
41 }
42
43 cfg.String("root", false, false, s.root, &s.root)
44 if _, err := cfg.Process(); err != nil {
45 return err
46 }
47
48 if s.root == "" {
49 return config.NodeErr(cfg.Block, "storage.blob.fs: directory not set")
50 }
51
52 if err := os.MkdirAll(s.root, os.ModeDir|os.ModePerm); err != nil {
53 return err
54 }
55
56 return nil
57}
58
59func (s *FSStore) Open(_ context.Context, key string) (io.ReadCloser, error) {
60 f, err := os.Open(filepath.Join(s.root, key))

Callers

nothing calls this directly

Calls 3

NodeErrFunction · 0.92
ProcessMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected