mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 21:44:56 -04:00
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`.
This commit is contained in:
parent
c276bd9969
commit
6b5a115c0a
7 changed files with 33 additions and 25 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue