mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-08 06:33:09 -06:00
Simplify sync API AddPublicRoutes
This commit is contained in:
parent
0c4f19fcb2
commit
99e8e20039
|
|
@ -28,9 +28,9 @@ func SyncAPI(base *basepkg.BaseDendrite, cfg *config.Dendrite) {
|
||||||
|
|
||||||
syncapi.AddPublicRoutes(
|
syncapi.AddPublicRoutes(
|
||||||
base,
|
base,
|
||||||
base.PublicClientAPIMux, userAPI, rsAPI,
|
userAPI, rsAPI,
|
||||||
base.KeyServerHTTPClient(),
|
base.KeyServerHTTPClient(),
|
||||||
federation, &cfg.SyncAPI,
|
federation,
|
||||||
)
|
)
|
||||||
|
|
||||||
base.SetupAndServeHTTP(
|
base.SetupAndServeHTTP(
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ func (m *Monolith) AddAllPublicRoutes(base *base.BaseDendrite, csMux, ssMux, key
|
||||||
base, m.UserAPI, m.Client,
|
base, m.UserAPI, m.Client,
|
||||||
)
|
)
|
||||||
syncapi.AddPublicRoutes(
|
syncapi.AddPublicRoutes(
|
||||||
base, csMux, m.UserAPI, m.RoomserverAPI,
|
base, m.UserAPI, m.RoomserverAPI, m.KeyAPI, m.FedClient,
|
||||||
m.KeyAPI, m.FedClient, &m.Config.SyncAPI,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,12 @@ package syncapi
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"github.com/matrix-org/dendrite/internal/caching"
|
"github.com/matrix-org/dendrite/internal/caching"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
keyapi "github.com/matrix-org/dendrite/keyserver/api"
|
keyapi "github.com/matrix-org/dendrite/keyserver/api"
|
||||||
"github.com/matrix-org/dendrite/roomserver/api"
|
"github.com/matrix-org/dendrite/roomserver/api"
|
||||||
"github.com/matrix-org/dendrite/setup/base"
|
"github.com/matrix-org/dendrite/setup/base"
|
||||||
"github.com/matrix-org/dendrite/setup/config"
|
|
||||||
"github.com/matrix-org/dendrite/setup/jetstream"
|
"github.com/matrix-org/dendrite/setup/jetstream"
|
||||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
@ -42,13 +40,13 @@ import (
|
||||||
// component.
|
// component.
|
||||||
func AddPublicRoutes(
|
func AddPublicRoutes(
|
||||||
base *base.BaseDendrite,
|
base *base.BaseDendrite,
|
||||||
router *mux.Router,
|
|
||||||
userAPI userapi.UserInternalAPI,
|
userAPI userapi.UserInternalAPI,
|
||||||
rsAPI api.RoomserverInternalAPI,
|
rsAPI api.RoomserverInternalAPI,
|
||||||
keyAPI keyapi.KeyInternalAPI,
|
keyAPI keyapi.KeyInternalAPI,
|
||||||
federation *gomatrixserverlib.FederationClient,
|
federation *gomatrixserverlib.FederationClient,
|
||||||
cfg *config.SyncAPI,
|
|
||||||
) {
|
) {
|
||||||
|
cfg := &base.Cfg.SyncAPI
|
||||||
|
|
||||||
js, natsClient := jetstream.Prepare(base.ProcessContext, &cfg.Matrix.JetStream)
|
js, natsClient := jetstream.Prepare(base.ProcessContext, &cfg.Matrix.JetStream)
|
||||||
|
|
||||||
syncDB, err := storage.NewSyncServerDatasource(base, &cfg.Database)
|
syncDB, err := storage.NewSyncServerDatasource(base, &cfg.Database)
|
||||||
|
|
@ -148,5 +146,8 @@ func AddPublicRoutes(
|
||||||
logrus.WithError(err).Panicf("failed to start presence consumer")
|
logrus.WithError(err).Panicf("failed to start presence consumer")
|
||||||
}
|
}
|
||||||
|
|
||||||
routing.Setup(router, requestPool, syncDB, userAPI, federation, rsAPI, cfg, lazyLoadCache)
|
routing.Setup(
|
||||||
|
base.PublicClientAPIMux, requestPool, syncDB, userAPI,
|
||||||
|
federation, rsAPI, cfg, lazyLoadCache,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue