Dependency inject the federation client so p2p binaries work as expected (#987)

This commit is contained in:
Kegsay 2020-04-28 16:51:16 +01:00 committed by GitHub
parent 0354836b57
commit a4b9edb28e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 5 deletions

View file

@ -148,7 +148,7 @@ func main() {
federation := createFederationClient(base)
keyRing := keydb.CreateKeyRing(federation.Client, keyDB, cfg.Matrix.KeyPerspectives)
alias, input, query := roomserver.SetupRoomServerComponent(&base.Base, keyRing)
alias, input, query := roomserver.SetupRoomServerComponent(&base.Base, keyRing, federation)
eduInputAPI := eduserver.SetupEDUServerComponent(&base.Base, cache.New())
asQuery := appservice.SetupAppServiceAPIComponent(
&base.Base, accountDB, deviceDB, federation, alias, query, transactions.New(),

View file

@ -57,7 +57,7 @@ func main() {
federation := base.CreateFederationClient()
keyRing := keydb.CreateKeyRing(federation.Client, keyDB, cfg.Matrix.KeyPerspectives)
alias, input, query := roomserver.SetupRoomServerComponent(base, keyRing)
alias, input, query := roomserver.SetupRoomServerComponent(base, keyRing, federation)
eduInputAPI := eduserver.SetupEDUServerComponent(base, cache.New())
asQuery := appservice.SetupAppServiceAPIComponent(
base, accountDB, deviceDB, federation, alias, query, transactions.New(),

View file

@ -30,7 +30,7 @@ func main() {
federation := base.CreateFederationClient()
keyRing := keydb.CreateKeyRing(federation.Client, keyDB, cfg.Matrix.KeyPerspectives)
roomserver.SetupRoomServerComponent(base, keyRing)
roomserver.SetupRoomServerComponent(base, keyRing, federation)
base.SetupAndServeHTTP(string(base.Cfg.Bind.RoomServer), string(base.Cfg.Listen.RoomServer))

View file

@ -123,7 +123,7 @@ func main() {
}
p2pPublicRoomProvider := NewLibP2PPublicRoomsProvider(node)
alias, input, query := roomserver.SetupRoomServerComponent(base, keyRing)
alias, input, query := roomserver.SetupRoomServerComponent(base, keyRing, federation)
eduInputAPI := eduserver.SetupEDUServerComponent(base, cache.New())
asQuery := appservice.SetupAppServiceAPIComponent(
base, accountDB, deviceDB, federation, alias, query, transactions.New(),

View file

@ -35,6 +35,7 @@ import (
// APIs directly instead of having to use HTTP.
func SetupRoomServerComponent(
base *basecomponent.BaseDendrite, keyRing gomatrixserverlib.JSONVerifier,
fedClient *gomatrixserverlib.FederationClient,
) (api.RoomserverAliasAPI, api.RoomserverInputAPI, api.RoomserverQueryAPI) {
roomserverDB, err := storage.Open(string(base.Cfg.Database.RoomServer))
if err != nil {
@ -53,7 +54,7 @@ func SetupRoomServerComponent(
DB: roomserverDB,
ImmutableCache: base.ImmutableCache,
ServerName: base.Cfg.Matrix.ServerName,
FedClient: base.CreateFederationClient(),
FedClient: fedClient,
// TODO: We should have a key server so we don't keep adding components
// which talk to the same DB.
KeyRing: keyRing,