MCPcopy Create free account
hub / github.com/DoNewsCode/core / New

Function New

config/module.go:37–55  ·  view source on GitHub ↗

New creates a new config module. It contains the init command.

(p ConfigIn)

Source from the content-addressed store, hash-verified

35
36// New creates a new config module. It contains the init command.
37func New(p ConfigIn) (Module, error) {
38 var (
39 ok bool
40 adapter *KoanfAdapter
41 )
42 if adapter, ok = p.Conf.(*KoanfAdapter); !ok {
43 return Module{}, fmt.Errorf("expects a *config.KoanfAdapter instance, but %T given", p.Conf)
44 }
45
46 if err := loadValidators(adapter, p.ExportedConfigs); err != nil {
47 return Module{}, err
48 }
49
50 return Module{
51 dispatcher: p.Dispatcher,
52 conf: adapter,
53 exportedConfigs: p.ExportedConfigs,
54 }, nil
55}
56
57// ProvideRunGroup runs the configuration watcher.
58func (m Module) ProvideRunGroup(group *run.Group) {

Callers 1

TestModule_WatchFunction · 0.70

Calls 1

loadValidatorsFunction · 0.85

Tested by 1

TestModule_WatchFunction · 0.56