From 85375ef96bb1c7687b91cc36ab54a758277e4408 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 28 Jul 2020 17:43:53 +0100 Subject: [PATCH] Don't forget current state and EDU servers --- currentstateserver/currentstateserver.go | 6 +++--- currentstateserver/currentstateserver_test.go | 8 +++++--- eduserver/eduserver.go | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/currentstateserver/currentstateserver.go b/currentstateserver/currentstateserver.go index 07d5e54ad..8c9d5bc9c 100644 --- a/currentstateserver/currentstateserver.go +++ b/currentstateserver/currentstateserver.go @@ -34,13 +34,13 @@ func AddInternalRoutes(router *mux.Router, intAPI api.CurrentStateInternalAPI) { // NewInternalAPI returns a concrete implementation of the internal API. Callers // can call functions directly on the returned API or via an HTTP interface using AddInternalRoutes. -func NewInternalAPI(cfg *config.Dendrite, consumer sarama.Consumer) api.CurrentStateInternalAPI { - csDB, err := storage.NewDatabase(string(cfg.Database.CurrentState), cfg.DbProperties()) +func NewInternalAPI(cfg *config.CurrentStateServer, consumer sarama.Consumer) api.CurrentStateInternalAPI { + csDB, err := storage.NewDatabase(string(cfg.Database), cfg.DatabaseOptions) if err != nil { logrus.WithError(err).Panicf("failed to open database") } roomConsumer := consumers.NewOutputRoomEventConsumer( - string(cfg.Kafka.Topics.OutputRoomEvent), consumer, csDB, + string(cfg.Matrix.Kafka.Topics.OutputRoomEvent), consumer, csDB, ) if err = roomConsumer.Start(); err != nil { logrus.WithError(err).Panicf("failed to start room server consumer") diff --git a/currentstateserver/currentstateserver_test.go b/currentstateserver/currentstateserver_test.go index 1366a0be8..1cdeb56d1 100644 --- a/currentstateserver/currentstateserver_test.go +++ b/currentstateserver/currentstateserver_test.go @@ -92,9 +92,11 @@ func MustWriteOutputEvent(t *testing.T, producer sarama.SyncProducer, out *rooms } func MustMakeInternalAPI(t *testing.T) (api.CurrentStateInternalAPI, sarama.SyncProducer) { - cfg := &config.Dendrite{} - cfg.Kafka.Topics.OutputRoomEvent = config.Topic(kafkaTopic) - cfg.Database.CurrentState = config.DataSource("file::memory:") + cfg := &config.CurrentStateServer{ + Matrix: &config.Global{}, + } + cfg.Matrix.Kafka.Topics.OutputRoomEvent = config.Topic(kafkaTopic) + cfg.Database = config.DataSource("file::memory:") db, err := sqlutil.Open(sqlutil.SQLiteDriverName(), "file::memory:", nil) if err != nil { t.Fatalf("Failed to open naffka database: %s", err) diff --git a/eduserver/eduserver.go b/eduserver/eduserver.go index 2e6ba0c85..e0e61b1a3 100644 --- a/eduserver/eduserver.go +++ b/eduserver/eduserver.go @@ -39,12 +39,13 @@ func NewInternalAPI( eduCache *cache.EDUCache, userAPI userapi.UserInternalAPI, ) api.EDUServerInputAPI { + cfg := &base.Cfg.EDUServer return &input.EDUServerInputAPI{ Cache: eduCache, UserAPI: userAPI, Producer: base.KafkaProducer, - OutputTypingEventTopic: string(base.Cfg.Kafka.Topics.OutputTypingEvent), - OutputSendToDeviceEventTopic: string(base.Cfg.Kafka.Topics.OutputSendToDeviceEvent), - ServerName: base.Cfg.Matrix.ServerName, + OutputTypingEventTopic: string(cfg.Matrix.Kafka.Topics.OutputTypingEvent), + OutputSendToDeviceEventTopic: string(cfg.Matrix.Kafka.Topics.OutputSendToDeviceEvent), + ServerName: cfg.Matrix.ServerName, } }