mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-31 13:34:14 -04:00
Use direct references for some configuration variables (part 3) (#10885)
This avoids the overhead of searching through the various configuration classes by directly referencing the class that the attributes are in. It also improves type hints since mypy can now resolve the types of the configuration variables.
This commit is contained in:
parent
aa2c027792
commit
e584534403
32 changed files with 137 additions and 119 deletions
|
@ -84,14 +84,15 @@ class ConsentResource(DirectServeHtmlResource):
|
|||
# this is required by the request_handler wrapper
|
||||
self.clock = hs.get_clock()
|
||||
|
||||
self._default_consent_version = hs.config.user_consent_version
|
||||
if self._default_consent_version is None:
|
||||
# Consent must be configured to create this resource.
|
||||
default_consent_version = hs.config.consent.user_consent_version
|
||||
consent_template_directory = hs.config.consent.user_consent_template_dir
|
||||
if default_consent_version is None or consent_template_directory is None:
|
||||
raise ConfigError(
|
||||
"Consent resource is enabled but user_consent section is "
|
||||
"missing in config file."
|
||||
)
|
||||
|
||||
consent_template_directory = hs.config.user_consent_template_dir
|
||||
self._default_consent_version = default_consent_version
|
||||
|
||||
# TODO: switch to synapse.util.templates.build_jinja_env
|
||||
loader = jinja2.FileSystemLoader(consent_template_directory)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue