From 4c3f929f8e4a9dd55ceeeef0ff541586c6ab9701 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 2 Dec 2020 15:31:15 +0000 Subject: [PATCH] Enable MSC2836 in the p2p demo --- cmd/dendrite-demo-libp2p/main.go | 5 +++++ internal/mscs/mscs.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/cmd/dendrite-demo-libp2p/main.go b/cmd/dendrite-demo-libp2p/main.go index 61fdd801a..0f5e6d8e6 100644 --- a/cmd/dendrite-demo-libp2p/main.go +++ b/cmd/dendrite-demo-libp2p/main.go @@ -33,6 +33,7 @@ import ( "github.com/matrix-org/dendrite/federationsender" "github.com/matrix-org/dendrite/internal/config" "github.com/matrix-org/dendrite/internal/httputil" + "github.com/matrix-org/dendrite/internal/mscs" "github.com/matrix-org/dendrite/internal/setup" "github.com/matrix-org/dendrite/keyserver" "github.com/matrix-org/dendrite/roomserver" @@ -130,6 +131,7 @@ func main() { cfg.AppServiceAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-appservice.db", *instanceName)) cfg.Global.Kafka.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-naffka.db", *instanceName)) cfg.KeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-e2ekey.db", *instanceName)) + cfg.MSCs.MSCs = []string{"msc2836"} if err = cfg.Derive(); err != nil { panic(err) } @@ -190,6 +192,9 @@ func main() { base.Base.PublicKeyAPIMux, base.Base.PublicMediaAPIMux, ) + if err := mscs.Enable(&base.Base, &monolith); err != nil { + logrus.WithError(err).Fatalf("Failed to enable MSCs") + } httpRouter := mux.NewRouter().SkipClean(true).UseEncodedPath() httpRouter.PathPrefix(httputil.InternalPathPrefix).Handler(base.Base.InternalAPIMux) diff --git a/internal/mscs/mscs.go b/internal/mscs/mscs.go index 0a896ab0f..c5cadec9f 100644 --- a/internal/mscs/mscs.go +++ b/internal/mscs/mscs.go @@ -16,15 +16,18 @@ package mscs import ( + "context" "fmt" "github.com/matrix-org/dendrite/internal/mscs/msc2836" "github.com/matrix-org/dendrite/internal/setup" + "github.com/matrix-org/util" ) // Enable MSCs - returns an error on unknown MSCs func Enable(base *setup.BaseDendrite, monolith *setup.Monolith) error { for _, msc := range base.Cfg.MSCs.MSCs { + util.GetLogger(context.Background()).WithField("msc", msc).Info("Enabling MSC") if err := EnableMSC(base, monolith, msc); err != nil { return err }