summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2022-02-01 16:23:55 +0100
committerGitHub <noreply@github.com>2022-02-01 16:23:55 +0100
commit5c16c3302125f2a5d8a006ad42792f22b320c737 (patch)
tree0058b056c1c0c0014fcd2e3b08f2a4eab1c52c70 /synapse
parentSend to-device messages to application services (#11215) (diff)
downloadsynapse-5c16c3302125f2a5d8a006ad42792f22b320c737.tar.xz
Allow modules to retrieve server and worker names (#11868)
Fixes #10701
Diffstat (limited to 'synapse')
-rw-r--r--synapse/module_api/__init__.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py
index 788b2e47d5..29fbc73c97 100644
--- a/synapse/module_api/__init__.py
+++ b/synapse/module_api/__init__.py
@@ -401,6 +401,32 @@ class ModuleApi:
         """
         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]:
         """Get user info by user_id