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

Method Configure

internal/table/file.go:74–105  ·  view source on GitHub ↗
(inlineArgs []string, cfg *config.Map)

Source from the content-addressed store, hash-verified

72}
73
74func (f *File) Configure(inlineArgs []string, cfg *config.Map) error {
75 switch len(inlineArgs) {
76 case 1:
77 f.file = inlineArgs[0]
78 case 0:
79 default:
80 return fmt.Errorf("%s: cannot use multiple files with single %s, use %s multiple times to do so", FileModName, FileModName, FileModName)
81 }
82
83 var file string
84 cfg.Bool("debug", true, false, &f.log.Debug)
85 cfg.String("file", false, false, "", &file)
86 if _, err := cfg.Process(); err != nil {
87 return err
88 }
89
90 if file != "" {
91 if f.file != "" {
92 return fmt.Errorf("%s: file path specified both in directive and in argument, do it once", FileModName)
93 }
94 f.file = file
95 }
96
97 if err := readFile(f.file, f.m); err != nil {
98 if !os.IsNotExist(err) {
99 return err
100 }
101 f.log.Printf("ignoring non-existent file: %s", f.file)
102 }
103
104 return nil
105}
106
107func (f *File) Start() error {
108 go f.reloader()

Callers 3

TestFileReloadFunction · 0.95
TestFileReload_BrokenFunction · 0.95
TestFileReload_RemovedFunction · 0.95

Calls 5

readFileFunction · 0.85
BoolMethod · 0.80
ProcessMethod · 0.80
StringMethod · 0.45
PrintfMethod · 0.45

Tested by 3

TestFileReloadFunction · 0.76
TestFileReload_BrokenFunction · 0.76
TestFileReload_RemovedFunction · 0.76