diff options
author | Kegsay <kegan@matrix.org> | 2020-06-08 15:51:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-08 15:51:07 +0100 |
commit | 4f171c56a832c836b0eb21650ee84d56e451dd6a (patch) | |
tree | e92059f1dbb784c978b60897d6ac13983d51c1b4 /cmd/dendritejs/main.go | |
parent | cdb9a115715bd5a9e84df5bc95060e2dac1f6d89 (diff) |
Split out SetupFooComponent (#1106)
* Split out adding HTTP routes from making internal APIs for clarity
* Split out more components
* Split out more things
* Finish converting
* internal mux for internal routes
Diffstat (limited to 'cmd/dendritejs/main.go')
-rw-r--r-- | cmd/dendritejs/main.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/cmd/dendritejs/main.go b/cmd/dendritejs/main.go index 4c1b8197..9c6c7c03 100644 --- a/cmd/dendritejs/main.go +++ b/cmd/dendritejs/main.go @@ -206,29 +206,29 @@ func main() { KeyDatabase: fetcher, } - rsAPI := roomserver.SetupRoomServerComponent(base, keyRing, federation) - eduInputAPI := eduserver.SetupEDUServerComponent(base, cache.New(), deviceDB) - asQuery := appservice.SetupAppServiceAPIComponent( - base, accountDB, deviceDB, federation, rsAPI, transactions.New(), + rsAPI := roomserver.NewInternalAPI(base, keyRing, federation) + eduInputAPI := eduserver.NewInternalAPI(base, cache.New(), deviceDB) + asQuery := appservice.NewInternalAPI( + base, accountDB, deviceDB, rsAPI, ) - fedSenderAPI := federationsender.SetupFederationSenderComponent(base, federation, rsAPI, &keyRing) + fedSenderAPI := federationsender.NewInternalAPI(base, federation, rsAPI, &keyRing) rsAPI.SetFederationSenderAPI(fedSenderAPI) p2pPublicRoomProvider := NewLibP2PPublicRoomsProvider(node, fedSenderAPI) - clientapi.SetupClientAPIComponent( - base, deviceDB, accountDB, + clientapi.AddPublicRoutes( + base.PublicAPIMux, base, deviceDB, accountDB, federation, &keyRing, rsAPI, eduInputAPI, asQuery, transactions.New(), fedSenderAPI, ) eduProducer := producers.NewEDUServerProducer(eduInputAPI) - federationapi.SetupFederationAPIComponent(base, accountDB, deviceDB, federation, &keyRing, rsAPI, asQuery, fedSenderAPI, eduProducer) - mediaapi.SetupMediaAPIComponent(base, deviceDB) + federationapi.AddPublicRoutes(base.PublicAPIMux, base.Cfg, accountDB, deviceDB, federation, &keyRing, rsAPI, asQuery, fedSenderAPI, eduProducer) + mediaapi.AddPublicRoutes(base.PublicAPIMux, base.Cfg, deviceDB) publicRoomsDB, err := storage.NewPublicRoomsServerDatabase(string(base.Cfg.Database.PublicRoomsAPI), cfg.Matrix.ServerName) if err != nil { logrus.WithError(err).Panicf("failed to connect to public rooms db") } - publicroomsapi.SetupPublicRoomsAPIComponent(base, deviceDB, publicRoomsDB, rsAPI, federation, p2pPublicRoomProvider) - syncapi.SetupSyncAPIComponent(base, deviceDB, accountDB, rsAPI, federation, cfg) + publicroomsapi.AddPublicRoutes(base.PublicAPIMux, base, deviceDB, publicRoomsDB, rsAPI, federation, p2pPublicRoomProvider) + syncapi.AddPublicRoutes(base.PublicAPIMux, base, deviceDB, accountDB, rsAPI, federation, cfg) internal.SetupHTTPAPI( http.DefaultServeMux, |