summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2019-08-13 21:49:28 +1000
committerGitHub <noreply@github.com>2019-08-13 21:49:28 +1000
commit0b6fbb28a858f56766c77eedede7d1dade9e9b1c (patch)
tree57915f5d49e201849c2656d05ec00b7a0f58e9a8 /synapse/app
parentMerge pull request #5836 from matrix-org/erikj/lower_bound_ttl_well_known (diff)
downloadsynapse-0b6fbb28a858f56766c77eedede7d1dade9e9b1c.tar.xz
Don't load the media repo when configured to use an external media repo (#5754)
Diffstat (limited to 'synapse/app')
-rw-r--r--synapse/app/media_repository.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/app/media_repository.py b/synapse/app/media_repository.py
index ea26f29acb..3a168577c7 100644
--- a/synapse/app/media_repository.py
+++ b/synapse/app/media_repository.py
@@ -26,6 +26,7 @@ from synapse.app import _base
 from synapse.config._base import ConfigError
 from synapse.config.homeserver import HomeServerConfig
 from synapse.config.logger import setup_logging
+from synapse.http.server import JsonResource
 from synapse.http.site import SynapseSite
 from synapse.logging.context import LoggingContext
 from synapse.metrics import METRICS_PREFIX, MetricsResource, RegistryProxy
@@ -35,6 +36,7 @@ from synapse.replication.slave.storage.client_ips import SlavedClientIpStore
 from synapse.replication.slave.storage.registration import SlavedRegistrationStore
 from synapse.replication.slave.storage.transactions import SlavedTransactionStore
 from synapse.replication.tcp.client import ReplicationClientHandler
+from synapse.rest.admin import register_servlets_for_media_repo
 from synapse.rest.media.v0.content_repository import ContentRepoResource
 from synapse.server import HomeServer
 from synapse.storage.engines import create_engine
@@ -71,6 +73,12 @@ class MediaRepositoryServer(HomeServer):
                     resources[METRICS_PREFIX] = MetricsResource(RegistryProxy)
                 elif name == "media":
                     media_repo = self.get_media_repository_resource()
+
+                    # We need to serve the admin servlets for media on the
+                    # worker.
+                    admin_resource = JsonResource(self, canonical_json=False)
+                    register_servlets_for_media_repo(self, admin_resource)
+
                     resources.update(
                         {
                             MEDIA_PREFIX: media_repo,
@@ -78,6 +86,7 @@ class MediaRepositoryServer(HomeServer):
                             CONTENT_REPO_PREFIX: ContentRepoResource(
                                 self, self.config.uploads_path
                             ),
+                            "/_synapse/admin": admin_resource,
                         }
                     )