api.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Copyright 2015, 2016 OpenMarket Ltd
  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 synapse.api.constants import EventTypes
  15. from ._base import Config
  16. class ApiConfig(Config):
  17. section = "api"
  18. def read_config(self, config, **kwargs):
  19. self.room_invite_state_types = config.get(
  20. "room_invite_state_types",
  21. [
  22. EventTypes.JoinRules,
  23. EventTypes.CanonicalAlias,
  24. EventTypes.RoomAvatar,
  25. EventTypes.RoomEncryption,
  26. EventTypes.Name,
  27. ],
  28. )
  29. def generate_config_section(cls, **kwargs):
  30. return """\
  31. ## API Configuration ##
  32. # A list of event types that will be included in the room_invite_state
  33. #
  34. #room_invite_state_types:
  35. # - "{JoinRules}"
  36. # - "{CanonicalAlias}"
  37. # - "{RoomAvatar}"
  38. # - "{RoomEncryption}"
  39. # - "{Name}"
  40. """.format(
  41. **vars(EventTypes)
  42. )