File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments