[#1243] node/cfg: Add notification config
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
16543a1904
commit
5dba64fcc5
3 changed files with 19 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue