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:
Patrick Cloke 2021-09-23 07:13:34 -04:00 committed by GitHub
parent aa2c027792
commit e584534403
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 137 additions and 119 deletions

View file

@ -77,7 +77,7 @@ class LoginRestServlet(RestServlet):
# SSO configuration.
self.saml2_enabled = hs.config.saml2_enabled
self.cas_enabled = hs.config.cas_enabled
self.cas_enabled = hs.config.cas.cas_enabled
self.oidc_enabled = hs.config.oidc_enabled
self._msc2918_enabled = hs.config.access_token_lifetime is not None
@ -559,7 +559,7 @@ def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
if hs.config.access_token_lifetime is not None:
RefreshTokenServlet(hs).register(http_server)
SsoRedirectServlet(hs).register(http_server)
if hs.config.cas_enabled:
if hs.config.cas.cas_enabled:
CasTicketServlet(hs).register(http_server)