Skip to content

Commit 5549b9a

Browse files
committed
prevent config throwing a reflect error
1 parent b67437e commit 5549b9a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

config/config_js.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,24 @@ func (cfg *Config) NewNode() (host.Host, error) {
277277
}),
278278
)
279279

280+
fxopts = append(fxopts,
281+
fx.Provide(func(eventBus event.Bus, lifecycle fx.Lifecycle) (*swarm.Swarm, error) {
282+
sw, err := cfg.makeSwarm(eventBus, !cfg.DisableMetrics)
283+
if err != nil {
284+
return nil, err
285+
}
286+
lifecycle.Append(fx.Hook{
287+
OnStart: func(ctx context.Context) error {
288+
return sw.Listen(cfg.ListenAddrs...)
289+
},
290+
OnStop: func(ctx context.Context) error {
291+
return sw.Close()
292+
},
293+
})
294+
return sw, nil
295+
}),
296+
)
297+
280298
var bh *bhost.BasicHost
281299
fxopts = append(fxopts, fx.Invoke(func(bho *bhost.BasicHost) { bh = bho }))
282300
fxopts = append(fxopts, fx.Invoke(func(h *bhost.BasicHost, lifecycle fx.Lifecycle) {

0 commit comments

Comments
 (0)