Make sure we use the right logic for enabling the media repo. (#17424)
This removes the `enable_media_repo` attribute on the server config in favour of always using the `can_load_media_repo` in the media config. This should avoid issues like in #17420 in the future
This commit is contained in:
parent
ab62aa09da
commit
4f6194492a
|
@ -0,0 +1 @@
|
||||||
|
Make sure we always use the right logic for enabling the media repo.
|
|
@ -217,7 +217,7 @@ class SynapseHomeServer(HomeServer):
|
||||||
)
|
)
|
||||||
|
|
||||||
if name in ["media", "federation", "client"]:
|
if name in ["media", "federation", "client"]:
|
||||||
if self.config.server.enable_media_repo:
|
if self.config.media.can_load_media_repo:
|
||||||
media_repo = self.get_media_repository_resource()
|
media_repo = self.get_media_repository_resource()
|
||||||
resources.update(
|
resources.update(
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,7 +126,7 @@ class ContentRepositoryConfig(Config):
|
||||||
# Only enable the media repo if either the media repo is enabled or the
|
# Only enable the media repo if either the media repo is enabled or the
|
||||||
# current worker app is the media repo.
|
# current worker app is the media repo.
|
||||||
if (
|
if (
|
||||||
self.root.server.enable_media_repo is False
|
config.get("enable_media_repo", True) is False
|
||||||
and config.get("worker_app") != "synapse.app.media_repository"
|
and config.get("worker_app") != "synapse.app.media_repository"
|
||||||
):
|
):
|
||||||
self.can_load_media_repo = False
|
self.can_load_media_repo = False
|
||||||
|
|
|
@ -395,12 +395,6 @@ class ServerConfig(Config):
|
||||||
self.presence_router_config,
|
self.presence_router_config,
|
||||||
) = load_module(presence_router_config, ("presence", "presence_router"))
|
) = load_module(presence_router_config, ("presence", "presence_router"))
|
||||||
|
|
||||||
# whether to enable the media repository endpoints. This should be set
|
|
||||||
# to false if the media repository is running as a separate endpoint;
|
|
||||||
# doing so ensures that we will not run cache cleanup jobs on the
|
|
||||||
# master, potentially causing inconsistency.
|
|
||||||
self.enable_media_repo = config.get("enable_media_repo", True)
|
|
||||||
|
|
||||||
# Whether to require authentication to retrieve profile data (avatars,
|
# Whether to require authentication to retrieve profile data (avatars,
|
||||||
# display names) of other users through the client API.
|
# display names) of other users through the client API.
|
||||||
self.require_auth_for_profile_requests = config.get(
|
self.require_auth_for_profile_requests = config.get(
|
||||||
|
|
Loading…
Reference in New Issue