mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 21:32:46 +00:00
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.
This commit is contained in:
parent
4f171c56a8
commit
85ac8a3f5b
10 changed files with 170 additions and 76 deletions
|
@ -15,9 +15,10 @@
|
|||
package publicroomsapi
|
||||
|
||||
import (
|
||||
"github.com/Shopify/sarama"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/storage/devices"
|
||||
"github.com/matrix-org/dendrite/internal/basecomponent"
|
||||
"github.com/matrix-org/dendrite/internal/config"
|
||||
"github.com/matrix-org/dendrite/publicroomsapi/consumers"
|
||||
"github.com/matrix-org/dendrite/publicroomsapi/routing"
|
||||
"github.com/matrix-org/dendrite/publicroomsapi/storage"
|
||||
|
@ -31,7 +32,8 @@ import (
|
|||
// component.
|
||||
func AddPublicRoutes(
|
||||
router *mux.Router,
|
||||
base *basecomponent.BaseDendrite,
|
||||
cfg *config.Dendrite,
|
||||
consumer sarama.Consumer,
|
||||
deviceDB devices.Database,
|
||||
publicRoomsDB storage.Database,
|
||||
rsAPI roomserverAPI.RoomserverInternalAPI,
|
||||
|
@ -39,7 +41,7 @@ func AddPublicRoutes(
|
|||
extRoomsProvider types.ExternalPublicRoomsProvider,
|
||||
) {
|
||||
rsConsumer := consumers.NewOutputRoomEventConsumer(
|
||||
base.Cfg, base.KafkaConsumer, publicRoomsDB, rsAPI,
|
||||
cfg, consumer, publicRoomsDB, rsAPI,
|
||||
)
|
||||
if err := rsConsumer.Start(); err != nil {
|
||||
logrus.WithError(err).Panic("failed to start public rooms server consumer")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue