diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 0f85c16fc..2b2ee85cd 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -97,6 +97,8 @@ type cfg struct { cfgObject cfgObject + cfgNotifications cfgNotifications + metricsCollector *metrics.StorageMetrics workers []worker @@ -183,6 +185,12 @@ type cfgObject struct { cfgLocalStorage cfgLocalStorage } +type cfgNotifications struct { + enabled bool + nw notificationWriter + defaultTopic string +} + type cfgLocalStorage struct { localStorage *engine.StorageEngine diff --git a/cmd/neofs-node/main.go b/cmd/neofs-node/main.go index 343ed2d64..4647ed59b 100644 --- a/cmd/neofs-node/main.go +++ b/cmd/neofs-node/main.go @@ -76,11 +76,11 @@ func initApp(c *cfg) { initContainerService(c) initSessionService(c) initReputationService(c) + initNotifications(c) initObjectService(c) initProfiler(c) initMetrics(c) initControlService(c) - initNotifications(c) fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Open()) fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Init()) diff --git a/cmd/neofs-node/notificator.go b/cmd/neofs-node/notificator.go index fef1f884d..7c02e8b98 100644 --- a/cmd/neofs-node/notificator.go +++ b/cmd/neofs-node/notificator.go @@ -131,6 +131,15 @@ func initNotifications(c *cfg) { panic("could not created object notificator: " + err.Error()) } + c.cfgNotifications = cfgNotifications{ + enabled: true, + nw: notificationWriter{ + l: c.log, + w: natsSvc, + }, + defaultTopic: topic, + } + n := notificator.New(new(notificator.Prm). SetLogger(c.log). SetNotificationSource( @@ -139,10 +148,7 @@ func initNotifications(c *cfg) { l: c.log, defaultTopic: topic, }). - SetWriter(notificationWriter{ - l: c.log, - w: natsSvc, - }), + SetWriter(c.cfgNotifications.nw), ) addNewEpochAsyncNotificationHandler(c, func(e event.Event) {