diff options
author | Jonathan de Jong <jonathan@automatia.nl> | 2020-10-15 21:29:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-15 15:29:13 -0400 |
commit | 6b5a115c0a0f9036444cd8686b32afbdf5334915 (patch) | |
tree | 168f7026466ec07269c3cc4882f7572ac60fd64a /synapse/server.py | |
parent | Send some ephemeral events to appservices (#8437) (diff) | |
download | synapse-6b5a115c0a0f9036444cd8686b32afbdf5334915.tar.xz |
Solidify the HomeServer constructor. (#8515)
This implements a more standard API for instantiating a homeserver and moves some of the dependency injection into the test suite. More concretely this stops using `setattr` on all `kwargs` passed to `HomeServer`.
Diffstat (limited to 'synapse/server.py')
-rw-r--r-- | synapse/server.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/synapse/server.py b/synapse/server.py index f921ee4b53..21a232bbd9 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -205,7 +205,13 @@ class HomeServer(metaclass=abc.ABCMeta): # instantiated during setup() for future return by get_datastore() DATASTORE_CLASS = abc.abstractproperty() - def __init__(self, hostname: str, config: HomeServerConfig, reactor=None, **kwargs): + def __init__( + self, + hostname: str, + config: HomeServerConfig, + reactor=None, + version_string="Synapse", + ): """ Args: hostname : The hostname for the server. @@ -236,11 +242,9 @@ class HomeServer(metaclass=abc.ABCMeta): burst_count=config.rc_registration.burst_count, ) - self.datastores = None # type: Optional[Databases] + self.version_string = version_string - # Other kwargs are explicit dependencies - for depname in kwargs: - setattr(self, depname, kwargs[depname]) + self.datastores = None # type: Optional[Databases] def get_instance_id(self) -> str: """A unique ID for this synapse process instance. |