aboutsummaryrefslogtreecommitdiff
path: root/mediaapi
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 /mediaapi
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 'mediaapi')
-rw-r--r--mediaapi/mediaapi.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/mediaapi/mediaapi.go b/mediaapi/mediaapi.go
index f2fa1438..5976957c 100644
--- a/mediaapi/mediaapi.go
+++ b/mediaapi/mediaapi.go
@@ -15,11 +15,9 @@
package mediaapi
import (
- "github.com/gorilla/mux"
"github.com/matrix-org/dendrite/mediaapi/routing"
"github.com/matrix-org/dendrite/mediaapi/storage"
"github.com/matrix-org/dendrite/setup/base"
- "github.com/matrix-org/dendrite/setup/config"
userapi "github.com/matrix-org/dendrite/userapi/api"
"github.com/matrix-org/gomatrixserverlib"
"github.com/sirupsen/logrus"
@@ -28,18 +26,18 @@ import (
// AddPublicRoutes sets up and registers HTTP handlers for the MediaAPI component.
func AddPublicRoutes(
base *base.BaseDendrite,
- router *mux.Router,
- cfg *config.MediaAPI,
- rateLimit *config.RateLimiting,
userAPI userapi.UserInternalAPI,
client *gomatrixserverlib.Client,
) {
+ cfg := &base.Cfg.MediaAPI
+ rateCfg := &base.Cfg.ClientAPI.RateLimiting
+
mediaDB, err := storage.NewMediaAPIDatasource(base, &cfg.Database)
if err != nil {
logrus.WithError(err).Panicf("failed to connect to media db")
}
routing.Setup(
- router, cfg, rateLimit, mediaDB, userAPI, client,
+ base.PublicMediaAPIMux, cfg, rateCfg, mediaDB, userAPI, client,
)
}