summary refs log tree commit diff
path: root/synapse/server.py
diff options
context:
space:
mode:
authorRichard van der Hoff <github@rvanderhoff.org.uk>2017-11-22 16:46:09 +0000
committerGitHub <noreply@github.com>2017-11-22 16:46:09 +0000
commit79eba878a78acc59908505d41c7890a29f5cc41b (patch)
tree6bbaf289bb72c86a5d1002f69934bd6f20e0ad29 /synapse/server.py
parentMerge pull request #2700 from matrix-org/rav/worker_docs (diff)
parentAdd config option to disable media_repo on main synapse (diff)
downloadsynapse-79eba878a78acc59908505d41c7890a29f5cc41b.tar.xz
Merge pull request #2701 from matrix-org/rav/one_mediarepo_to_rule_them_all
Try to avoid having multiple PreviewUrlResource instances
Diffstat (limited to 'synapse/server.py')
-rw-r--r--synapse/server.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/server.py b/synapse/server.py
index 4746cc7b6c..853f4647b7 100644
--- a/synapse/server.py
+++ b/synapse/server.py
@@ -60,7 +60,10 @@ from synapse.http.matrixfederationclient import MatrixFederationHttpClient
 from synapse.notifier import Notifier
 from synapse.push.action_generator import ActionGenerator
 from synapse.push.pusherpool import PusherPool
-from synapse.rest.media.v1.media_repository import MediaRepository
+from synapse.rest.media.v1.media_repository import (
+    MediaRepository,
+    MediaRepositoryResource,
+)
 from synapse.state import StateHandler
 from synapse.storage import DataStore
 from synapse.streams.events import EventSources
@@ -121,6 +124,7 @@ class HomeServer(object):
         'http_client_context_factory',
         'simple_http_client',
         'media_repository',
+        'media_repository_resource',
         'federation_transport_client',
         'federation_sender',
         'receipts_handler',
@@ -293,6 +297,11 @@ class HomeServer(object):
             **self.db_config.get("args", {})
         )
 
+    def build_media_repository_resource(self):
+        # build the media repo resource. This indirects through the HomeServer
+        # to ensure that we only have a single instance of
+        return MediaRepositoryResource(self)
+
     def build_media_repository(self):
         return MediaRepository(self)