mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Allow modules to retrieve server and worker names (#11868)
Fixes #10701
This commit is contained in:
parent
64ec45fc1b
commit
5c16c33021
1
changelog.d/11868.feature
Normal file
1
changelog.d/11868.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
Allow modules to retrieve the current instance's server name and worker name.
|
@ -401,6 +401,32 @@ class ModuleApi:
|
|||||||
"""
|
"""
|
||||||
return self._hs.config.email.email_app_name
|
return self._hs.config.email.email_app_name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def server_name(self) -> str:
|
||||||
|
"""The server name for the local homeserver.
|
||||||
|
|
||||||
|
Added in Synapse v1.53.0.
|
||||||
|
"""
|
||||||
|
return self._server_name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def worker_name(self) -> Optional[str]:
|
||||||
|
"""The name of the worker this specific instance is running as per the
|
||||||
|
"worker_name" configuration setting, or None if it's the main process.
|
||||||
|
|
||||||
|
Added in Synapse v1.53.0.
|
||||||
|
"""
|
||||||
|
return self._hs.config.worker.worker_name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def worker_app(self) -> Optional[str]:
|
||||||
|
"""The name of the worker app this specific instance is running as per the
|
||||||
|
"worker_app" configuration setting, or None if it's the main process.
|
||||||
|
|
||||||
|
Added in Synapse v1.53.0.
|
||||||
|
"""
|
||||||
|
return self._hs.config.worker.worker_app
|
||||||
|
|
||||||
async def get_userinfo_by_id(self, user_id: str) -> Optional[UserInfo]:
|
async def get_userinfo_by_id(self, user_id: str) -> Optional[UserInfo]:
|
||||||
"""Get user info by user_id
|
"""Get user info by user_id
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user