aboutsummaryrefslogtreecommitdiff
path: root/syncapi/syncapi.go
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-06-09 12:07:33 +0100
committerGitHub <noreply@github.com>2020-06-09 12:07:33 +0100
commit85ac8a3f5ba407ece584843a4d77466c1c4f5565 (patch)
treece98a9501386fd8467196d164eb35a53ad8cb78b /syncapi/syncapi.go
parent4f171c56a832c836b0eb21650ee84d56e451dd6a (diff)
Factor out how monolith routes get added (#1107)
Previously we had 3 monoliths: - dendrite-monolith-server - dendrite-demo-libp2p - dendritejs which all had their own of setting up public routes. Factor this out into a new `setup.Monolith` struct which gets all dependencies set as fields. This is different to `basecomponent.Base` which doesn't provide any way to set configured deps (e.g public rooms db) Part of a larger process to clean up how we initialise Dendrite.
Diffstat (limited to 'syncapi/syncapi.go')
-rw-r--r--syncapi/syncapi.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/syncapi/syncapi.go b/syncapi/syncapi.go
index 6e84dcb6..40e652af 100644
--- a/syncapi/syncapi.go
+++ b/syncapi/syncapi.go
@@ -17,11 +17,11 @@ package syncapi
import (
"context"
+ "github.com/Shopify/sarama"
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
"github.com/matrix-org/dendrite/clientapi/auth/storage/accounts"
- "github.com/matrix-org/dendrite/internal/basecomponent"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/gomatrixserverlib"
@@ -37,14 +37,14 @@ import (
// component.
func AddPublicRoutes(
router *mux.Router,
- base *basecomponent.BaseDendrite,
+ consumer sarama.Consumer,
deviceDB devices.Database,
accountsDB accounts.Database,
rsAPI api.RoomserverInternalAPI,
federation *gomatrixserverlib.FederationClient,
cfg *config.Dendrite,
) {
- syncDB, err := storage.NewSyncServerDatasource(string(base.Cfg.Database.SyncAPI), base.Cfg.DbProperties())
+ syncDB, err := storage.NewSyncServerDatasource(string(cfg.Database.SyncAPI), cfg.DbProperties())
if err != nil {
logrus.WithError(err).Panicf("failed to connect to sync db")
}
@@ -63,28 +63,28 @@ func AddPublicRoutes(
requestPool := sync.NewRequestPool(syncDB, notifier, accountsDB)
roomConsumer := consumers.NewOutputRoomEventConsumer(
- base.Cfg, base.KafkaConsumer, notifier, syncDB, rsAPI,
+ cfg, consumer, notifier, syncDB, rsAPI,
)
if err = roomConsumer.Start(); err != nil {
logrus.WithError(err).Panicf("failed to start room server consumer")
}
clientConsumer := consumers.NewOutputClientDataConsumer(
- base.Cfg, base.KafkaConsumer, notifier, syncDB,
+ cfg, consumer, notifier, syncDB,
)
if err = clientConsumer.Start(); err != nil {
logrus.WithError(err).Panicf("failed to start client data consumer")
}
typingConsumer := consumers.NewOutputTypingEventConsumer(
- base.Cfg, base.KafkaConsumer, notifier, syncDB,
+ cfg, consumer, notifier, syncDB,
)
if err = typingConsumer.Start(); err != nil {
logrus.WithError(err).Panicf("failed to start typing consumer")
}
sendToDeviceConsumer := consumers.NewOutputSendToDeviceEventConsumer(
- base.Cfg, base.KafkaConsumer, notifier, syncDB,
+ cfg, consumer, notifier, syncDB,
)
if err = sendToDeviceConsumer.Start(); err != nil {
logrus.WithError(err).Panicf("failed to start send-to-device consumer")