Allow modules to retrieve server and worker names (#11868)
Fixes #10701
This commit is contained in:
parent
64ec45fc1b
commit
5c16c33021
|
@ -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