MCPcopy Index your code
hub / github.com/foxcpp/maddy / moduleConfigure

Function moduleConfigure

maddy.go:362–396  ·  view source on GitHub ↗
(configPath string)

Source from the content-addressed store, hash-verified

360}
361
362func moduleConfigure(configPath string) (*container.C, error) {
363 c := container.New()
364 container.Global = c
365
366 cfg, err := ReadConfig(configPath)
367 if err != nil {
368 return nil, fmt.Errorf("failed to read config %s: %w", configPath, err)
369 }
370
371 globals, modBlocks, err := ReadGlobals(c, cfg)
372 if err != nil {
373 return nil, err
374 }
375
376 // ReadGlobals will configure c.DefaultLogger.
377 if c.DefaultLogger.Out != nil {
378 log.DefaultLogger.Out = c.DefaultLogger.Out
379 }
380
381 if err := InitDirs(c); err != nil {
382 return nil, err
383 }
384
385 err = RegisterModules(c, globals, modBlocks)
386 if err != nil {
387 return nil, err
388 }
389
390 for _, inst := range c.Modules.NotInitialized() {
391 return nil, fmt.Errorf("unused configuration block %s (%s)",
392 inst.InstanceName(), inst.Name())
393 }
394
395 return c, nil
396}
397
398func moduleStart(c *container.C) error {
399 return c.Lifetime.StartAll()

Callers 3

VerifyConfigFunction · 0.85
moduleMainFunction · 0.85
moduleReloadFunction · 0.85

Calls 8

NewFunction · 0.92
ReadConfigFunction · 0.85
ReadGlobalsFunction · 0.85
InitDirsFunction · 0.85
RegisterModulesFunction · 0.85
NotInitializedMethod · 0.80
InstanceNameMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected