summary refs log tree commit diff
path: root/synapse/config
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2022-05-31 17:35:29 +0100
committerGitHub <noreply@github.com>2022-05-31 16:35:29 +0000
commit2fc787c341ff540e5880932f116498ec0ed7a2c2 (patch)
tree7109d300222a8123fc572fe769389677bb6ca15d /synapse/config
parentFaster room joins: Resume state re-syncing after a Synapse restart (#12813) (diff)
downloadsynapse-2fc787c341ff540e5880932f116498ec0ed7a2c2.tar.xz
Add config options for media retention (#12732)
Diffstat (limited to 'synapse/config')
-rw-r--r--synapse/config/repository.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/config/repository.py b/synapse/config/repository.py
index 98d8a16621..f9c55143c3 100644
--- a/synapse/config/repository.py
+++ b/synapse/config/repository.py
@@ -223,6 +223,22 @@ class ContentRepositoryConfig(Config):
                 "url_preview_accept_language"
             ) or ["en"]
 
+        media_retention = config.get("media_retention") or {}
+
+        self.media_retention_local_media_lifetime_ms = None
+        local_media_lifetime = media_retention.get("local_media_lifetime")
+        if local_media_lifetime is not None:
+            self.media_retention_local_media_lifetime_ms = self.parse_duration(
+                local_media_lifetime
+            )
+
+        self.media_retention_remote_media_lifetime_ms = None
+        remote_media_lifetime = media_retention.get("remote_media_lifetime")
+        if remote_media_lifetime is not None:
+            self.media_retention_remote_media_lifetime_ms = self.parse_duration(
+                remote_media_lifetime
+            )
+
     def generate_config_section(self, data_dir_path: str, **kwargs: Any) -> str:
         assert data_dir_path is not None
         media_store = os.path.join(data_dir_path, "media_store")