diff options
author | Erik Johnston <erik@matrix.org> | 2016-01-28 14:45:36 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-01-28 14:45:36 +0000 |
commit | 167d1df699d64683f1f9ace759c772af1890ca56 (patch) | |
tree | a9222f66b36c828df5ca2fcd455db820dcd80dca /synapse/server.py | |
parent | Quot all the things (diff) | |
parent | Clean up a bit. Add comment (diff) | |
download | synapse-167d1df699d64683f1f9ace759c772af1890ca56.tar.xz |
Merge pull request #534 from matrix-org/erikj/setup
Add a Homeserver.setup method
Diffstat (limited to 'synapse/server.py')
-rw-r--r-- | synapse/server.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/synapse/server.py b/synapse/server.py index a59e46ca2d..5fee7fe130 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -40,6 +40,11 @@ from synapse.api.filtering import Filtering from synapse.http.matrixfederationclient import MatrixFederationHttpClient +import logging + + +logger = logging.getLogger(__name__) + class HomeServer(object): """A basic homeserver object without lazy component builders. @@ -102,10 +107,19 @@ class HomeServer(object): self.hostname = hostname self._building = {} + self.clock = Clock() + self.distributor = Distributor() + self.ratelimiter = Ratelimiter() + # Other kwargs are explicit dependencies for depname in kwargs: setattr(self, depname, kwargs[depname]) + def setup(self): + logger.info("Setting up.") + self.datastore = DataStore(self.get_db_conn(), self) + logger.info("Finished setting up.") + def get_ip_from_request(self, request): # X-Forwarded-For is handled by our custom request type. return request.getClientIP() @@ -116,15 +130,9 @@ class HomeServer(object): def is_mine_id(self, string): return string.split(":", 1)[1] == self.hostname - def build_clock(self): - return Clock() - def build_replication_layer(self): return initialize_http_replication(self) - def build_datastore(self): - return DataStore(self) - def build_handlers(self): return Handlers(self) @@ -135,10 +143,9 @@ class HomeServer(object): return Auth(self) def build_http_client_context_factory(self): - config = self.get_config() return ( InsecureInterceptableContextFactory() - if config.use_insecure_ssl_client_just_for_testing_do_not_use + if self.config.use_insecure_ssl_client_just_for_testing_do_not_use else BrowserLikePolicyForHTTPS() ) @@ -157,15 +164,9 @@ class HomeServer(object): def build_state_handler(self): return StateHandler(self) - def build_distributor(self): - return Distributor() - def build_event_sources(self): return EventSources(self) - def build_ratelimiter(self): - return Ratelimiter() - def build_keyring(self): return Keyring(self) |