aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-05-03 17:17:02 +0100
committerGitHub <noreply@github.com>2022-05-03 17:17:02 +0100
commitdd061a172e97005a4a7a4c37db6caf3f77c10d51 (patch)
tree6603b4825a7c5c335b8b9041339ed2ddd7d91c56 /cmd
parent4ad5f9c982fe5dc9e306a9269621ead8c31248cf (diff)
Tidy up `AddPublicRoutes` (#2412)
* Simplify federation API `AddPublicRoutes` * Simplify client API `AddPublicRoutes` * Simplify media API `AddPublicRoutes` * Simplify sync API `AddPublicRoutes` * Simplify `AddAllPublicRoutes`
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dendrite-demo-pinecone/main.go11
-rw-r--r--cmd/dendrite-demo-yggdrasil/main.go11
-rw-r--r--cmd/dendrite-monolith-server/main.go11
-rw-r--r--cmd/dendrite-polylith-multi/personalities/clientapi.go6
-rw-r--r--cmd/dendrite-polylith-multi/personalities/federationapi.go7
-rw-r--r--cmd/dendrite-polylith-multi/personalities/mediaapi.go3
-rw-r--r--cmd/dendrite-polylith-multi/personalities/syncapi.go4
-rw-r--r--cmd/dendritejs-pinecone/main.go11
8 files changed, 12 insertions, 52 deletions
diff --git a/cmd/dendrite-demo-pinecone/main.go b/cmd/dendrite-demo-pinecone/main.go
index 33487e64..70343605 100644
--- a/cmd/dendrite-demo-pinecone/main.go
+++ b/cmd/dendrite-demo-pinecone/main.go
@@ -185,16 +185,7 @@ func main() {
ExtPublicRoomsProvider: roomProvider,
ExtUserDirectoryProvider: userProvider,
}
- monolith.AddAllPublicRoutes(
- base,
- base.PublicClientAPIMux,
- base.PublicFederationAPIMux,
- base.PublicKeyAPIMux,
- base.PublicWellKnownAPIMux,
- base.PublicMediaAPIMux,
- base.SynapseAdminMux,
- base.DendriteAdminMux,
- )
+ monolith.AddAllPublicRoutes(base)
wsUpgrader := websocket.Upgrader{
CheckOrigin: func(_ *http.Request) bool {
diff --git a/cmd/dendrite-demo-yggdrasil/main.go b/cmd/dendrite-demo-yggdrasil/main.go
index df9ba512..619720d6 100644
--- a/cmd/dendrite-demo-yggdrasil/main.go
+++ b/cmd/dendrite-demo-yggdrasil/main.go
@@ -142,16 +142,7 @@ func main() {
ygg, fsAPI, federation,
),
}
- monolith.AddAllPublicRoutes(
- base,
- base.PublicClientAPIMux,
- base.PublicFederationAPIMux,
- base.PublicKeyAPIMux,
- base.PublicWellKnownAPIMux,
- base.PublicMediaAPIMux,
- base.SynapseAdminMux,
- base.DendriteAdminMux,
- )
+ monolith.AddAllPublicRoutes(base)
if err := mscs.Enable(base, &monolith); err != nil {
logrus.WithError(err).Fatalf("Failed to enable MSCs")
}
diff --git a/cmd/dendrite-monolith-server/main.go b/cmd/dendrite-monolith-server/main.go
index 4c7c4297..2fa4675a 100644
--- a/cmd/dendrite-monolith-server/main.go
+++ b/cmd/dendrite-monolith-server/main.go
@@ -143,16 +143,7 @@ func main() {
UserAPI: userAPI,
KeyAPI: keyAPI,
}
- monolith.AddAllPublicRoutes(
- base,
- base.PublicClientAPIMux,
- base.PublicFederationAPIMux,
- base.PublicKeyAPIMux,
- base.PublicWellKnownAPIMux,
- base.PublicMediaAPIMux,
- base.SynapseAdminMux,
- base.DendriteAdminMux,
- )
+ monolith.AddAllPublicRoutes(base)
if len(base.Cfg.MSCs.MSCs) > 0 {
if err := mscs.Enable(base, &monolith); err != nil {
diff --git a/cmd/dendrite-polylith-multi/personalities/clientapi.go b/cmd/dendrite-polylith-multi/personalities/clientapi.go
index 7ed2075a..a5d69d07 100644
--- a/cmd/dendrite-polylith-multi/personalities/clientapi.go
+++ b/cmd/dendrite-polylith-multi/personalities/clientapi.go
@@ -31,11 +31,9 @@ func ClientAPI(base *basepkg.BaseDendrite, cfg *config.Dendrite) {
keyAPI := base.KeyServerHTTPClient()
clientapi.AddPublicRoutes(
- base.ProcessContext, base.PublicClientAPIMux,
- base.SynapseAdminMux, base.DendriteAdminMux,
- &base.Cfg.ClientAPI, federation, rsAPI, asQuery,
+ base, federation, rsAPI, asQuery,
transactions.New(), fsAPI, userAPI, userAPI,
- keyAPI, nil, &cfg.MSCs,
+ keyAPI, nil,
)
base.SetupAndServeHTTP(
diff --git a/cmd/dendrite-polylith-multi/personalities/federationapi.go b/cmd/dendrite-polylith-multi/personalities/federationapi.go
index b82577ce..6377ce9e 100644
--- a/cmd/dendrite-polylith-multi/personalities/federationapi.go
+++ b/cmd/dendrite-polylith-multi/personalities/federationapi.go
@@ -29,10 +29,9 @@ func FederationAPI(base *basepkg.BaseDendrite, cfg *config.Dendrite) {
keyRing := fsAPI.KeyRing()
federationapi.AddPublicRoutes(
- base.ProcessContext, base.PublicFederationAPIMux, base.PublicKeyAPIMux, base.PublicWellKnownAPIMux,
- &base.Cfg.FederationAPI, userAPI, federation, keyRing,
- rsAPI, fsAPI, keyAPI,
- &base.Cfg.MSCs, nil,
+ base,
+ userAPI, federation, keyRing,
+ rsAPI, fsAPI, keyAPI, nil,
)
federationapi.AddInternalRoutes(base.InternalAPIMux, fsAPI)
diff --git a/cmd/dendrite-polylith-multi/personalities/mediaapi.go b/cmd/dendrite-polylith-multi/personalities/mediaapi.go
index 8c0bfa19..69d5fd5a 100644
--- a/cmd/dendrite-polylith-multi/personalities/mediaapi.go
+++ b/cmd/dendrite-polylith-multi/personalities/mediaapi.go
@@ -25,8 +25,7 @@ func MediaAPI(base *basepkg.BaseDendrite, cfg *config.Dendrite) {
client := base.CreateClient()
mediaapi.AddPublicRoutes(
- base, base.PublicMediaAPIMux, &base.Cfg.MediaAPI, &base.Cfg.ClientAPI.RateLimiting,
- userAPI, client,
+ base, userAPI, client,
)
base.SetupAndServeHTTP(
diff --git a/cmd/dendrite-polylith-multi/personalities/syncapi.go b/cmd/dendrite-polylith-multi/personalities/syncapi.go
index f9f1c5a0..2245b9b5 100644
--- a/cmd/dendrite-polylith-multi/personalities/syncapi.go
+++ b/cmd/dendrite-polylith-multi/personalities/syncapi.go
@@ -28,9 +28,9 @@ func SyncAPI(base *basepkg.BaseDendrite, cfg *config.Dendrite) {
syncapi.AddPublicRoutes(
base,
- base.PublicClientAPIMux, userAPI, rsAPI,
+ userAPI, rsAPI,
base.KeyServerHTTPClient(),
- federation, &cfg.SyncAPI,
+ federation,
)
base.SetupAndServeHTTP(
diff --git a/cmd/dendritejs-pinecone/main.go b/cmd/dendritejs-pinecone/main.go
index ead38136..e070173a 100644
--- a/cmd/dendritejs-pinecone/main.go
+++ b/cmd/dendritejs-pinecone/main.go
@@ -212,16 +212,7 @@ func startup() {
//ServerKeyAPI: serverKeyAPI,
ExtPublicRoomsProvider: rooms.NewPineconeRoomProvider(pRouter, pSessions, fedSenderAPI, federation),
}
- monolith.AddAllPublicRoutes(
- base,
- base.PublicClientAPIMux,
- base.PublicFederationAPIMux,
- base.PublicKeyAPIMux,
- base.PublicWellKnownAPIMux,
- base.PublicMediaAPIMux,
- base.SynapseAdminMux,
- base.DendriteAdminMux,
- )
+ monolith.AddAllPublicRoutes(base)
httpRouter := mux.NewRouter().SkipClean(true).UseEncodedPath()
httpRouter.PathPrefix(httputil.InternalPathPrefix).Handler(base.InternalAPIMux)