diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2021-08-17 14:45:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-17 14:45:24 +0200 |
commit | 56397599809e131174daaeb4c6dc18fde9db6c3f (patch) | |
tree | 89143336c80709dcab3834eeae1af9d6de069254 /synapse/config/server.py | |
parent | Attempt to pull from the legacy spaces summary API over federation. (#10583) (diff) | |
download | synapse-56397599809e131174daaeb4c6dc18fde9db6c3f.tar.xz |
Centralise the custom template directory (#10596)
Several configuration sections are using separate settings for custom template directories, which can be confusing. This PR adds a new top-level configuration for a custom template directory which is then used for every module. The only exception is the consent templates, since the consent template directory require a specific hierarchy, so it's probably better that it stays separate from everything else.
Diffstat (limited to 'synapse/config/server.py')
-rw-r--r-- | synapse/config/server.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/synapse/config/server.py b/synapse/config/server.py index 187b4301a0..8494795919 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py @@ -710,6 +710,18 @@ class ServerConfig(Config): # Turn the list into a set to improve lookup speed. self.next_link_domain_whitelist = set(next_link_domain_whitelist) + templates_config = config.get("templates") or {} + if not isinstance(templates_config, dict): + raise ConfigError("The 'templates' section must be a dictionary") + + self.custom_template_directory = templates_config.get( + "custom_template_directory" + ) + if self.custom_template_directory is not None and not isinstance( + self.custom_template_directory, str + ): + raise ConfigError("'custom_template_directory' must be a string") + def has_tls_listener(self) -> bool: return any(listener.tls for listener in self.listeners) @@ -1284,6 +1296,19 @@ class ServerConfig(Config): # all domains. # #next_link_domain_whitelist: ["matrix.org"] + + # Templates to use when generating email or HTML page contents. + # + templates: + # Directory in which Synapse will try to find template files to use to generate + # email or HTML page contents. + # If not set, or a file is not found within the template directory, a default + # template from within the Synapse package will be used. + # + # See https://matrix-org.github.io/synapse/latest/templates.html for more + # information about using custom templates. + # + #custom_template_directory: /path/to/custom/templates/ """ % locals() ) |