您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

45 行
1.7 KiB

  1. # Copyright 2020 The Matrix.org Foundation C.I.C.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from typing import Any
  15. from synapse.config._base import Config
  16. from synapse.types import JsonDict
  17. from synapse.util.check_dependencies import check_requirements
  18. class RedisConfig(Config):
  19. section = "redis"
  20. def read_config(self, config: JsonDict, **kwargs: Any) -> None:
  21. redis_config = config.get("redis") or {}
  22. self.redis_enabled = redis_config.get("enabled", False)
  23. if not self.redis_enabled:
  24. return
  25. check_requirements("redis")
  26. self.redis_host = redis_config.get("host", "localhost")
  27. self.redis_port = redis_config.get("port", 6379)
  28. self.redis_path = redis_config.get("path", None)
  29. self.redis_dbid = redis_config.get("dbid", None)
  30. self.redis_password = redis_config.get("password")
  31. self.redis_use_tls = redis_config.get("use_tls", False)
  32. self.redis_certificate = redis_config.get("certificate_file", None)
  33. self.redis_private_key = redis_config.get("private_key_file", None)
  34. self.redis_ca_file = redis_config.get("ca_file", None)
  35. self.redis_ca_path = redis_config.get("ca_path", None)