Matrix Docker Ansible eploy
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

379 rader
18 KiB

  1. # mautrix-telegram is a Matrix <-> Telegram bridge
  2. # See: https://github.com/tulir/mautrix-telegram
  3. matrix_mautrix_telegram_enabled: true
  4. matrix_mautrix_telegram_docker_image: "tulir/mautrix-telegram:v0.5.2"
  5. matrix_mautrix_telegram_docker_image_force_pull: "{{ matrix_mautrix_telegram_docker_image.endswith(':latest') }}"
  6. matrix_mautrix_telegram_base_path: "{{ matrix_base_data_path }}/mautrix-telegram"
  7. matrix_mautrix_telegram_config_path: "{{ matrix_mautrix_telegram_base_path }}/config"
  8. matrix_mautrix_telegram_data_path: "{{ matrix_mautrix_telegram_base_path }}/data"
  9. # Get your own API keys at https://my.telegram.org/apps
  10. matrix_mautrix_telegram_api_id: ''
  11. matrix_mautrix_telegram_api_hash: ''
  12. # Mautrix telegram public endpoint to log in to telegram
  13. # Use an uuid so it's not easily discoverable.
  14. # Example: /741a0483-ba17-4682-9900-30bd7269f1cc
  15. matrix_mautrix_telegram_public_endpoint: ''
  16. matrix_mautrix_telegram_homeserver_address: 'https://{{ matrix_server_fqn_matrix }}'
  17. matrix_mautrix_telegram_homeserver_domain: '{{ matrix_domain }}'
  18. matrix_mautrix_telegram_appservice_address: 'http://matrix-mautrix-telegram:8080'
  19. matrix_mautrix_telegram_appservice_public_external: 'https://{{ matrix_server_fqn_matrix }}{{ matrix_mautrix_telegram_public_endpoint }}'
  20. # Controls whether the matrix-telegram container exposes its HTTP port (tcp/8080 in the container).
  21. #
  22. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9006"), or empty string to not expose.
  23. matrix_mautrix_telegram_container_http_host_bind_port: ''
  24. # A list of extra arguments to pass to the container
  25. matrix_mautrix_telegram_container_extra_arguments: []
  26. # List of systemd services that matrix-mautrix-telegram.service depends on.
  27. matrix_mautrix_telegram_systemd_required_services_list: ['docker.service']
  28. # List of systemd services that matrix-mautrix-telegram.service wants
  29. matrix_mautrix_telegram_systemd_wanted_services_list: []
  30. matrix_mautrix_telegram_appservice_token: ''
  31. matrix_mautrix_telegram_homeserver_token: ''
  32. # Default mxisd configuration template which covers the generic use case.
  33. # You can customize it by controlling the various variables inside it.
  34. #
  35. # For a more advanced customization, you can extend the default (see `matrix_mautrix_telegram_configuration_extension_yaml`)
  36. # or completely replace this variable with your own template.
  37. matrix_mautrix_telegram_configuration_yaml: |
  38. #jinja2: lstrip_blocks: "True"
  39. # Homeserver details
  40. homeserver:
  41. # The address that this appservice can use to connect to the homeserver.
  42. address: {{ matrix_mautrix_telegram_homeserver_address }}
  43. # The domain of the homeserver (for MXIDs, etc).
  44. domain: {{ matrix_mautrix_telegram_homeserver_domain }}
  45. # Whether or not to verify the SSL certificate of the homeserver.
  46. # Only applies if address starts with https://
  47. verify_ssl: true
  48. # Application service host/registration related details
  49. # Changing these values requires regeneration of the registration.
  50. appservice:
  51. # The address that the homeserver can use to connect to this appservice.
  52. address: {{ matrix_mautrix_telegram_appservice_address }}
  53. # The hostname and port where this appservice should listen.
  54. hostname: 0.0.0.0
  55. port: 8080
  56. # The maximum body size of appservice API requests (from the homeserver) in mebibytes
  57. # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
  58. max_body_size: 1
  59. # The full URI to the database. SQLite and Postgres are fully supported.
  60. # Other DBMSes supported by SQLAlchemy may or may not work.
  61. # Format examples:
  62. # SQLite: sqlite:///filename.db
  63. # Postgres: postgres://username:password@hostname/dbname
  64. database: sqlite:////data/mautrix-telegram.db
  65. # Public part of web server for out-of-Matrix interaction with the bridge.
  66. # Used for things like login if the user wants to make sure the 2FA password isn't stored in
  67. # the HS database.
  68. public:
  69. # Whether or not the public-facing endpoints should be enabled.
  70. enabled: true
  71. # The prefix to use in the public-facing endpoints.
  72. prefix: {{ matrix_mautrix_telegram_public_endpoint }}
  73. # The base URL where the public-facing endpoints are available. The prefix is not added
  74. # implicitly.
  75. external: {{ matrix_mautrix_telegram_appservice_public_external }}
  76. # Provisioning API part of the web server for automated portal creation and fetching information.
  77. # Used by things like Dimension (https://dimension.t2bot.io/).
  78. provisioning:
  79. # Whether or not the provisioning API should be enabled.
  80. enabled: false
  81. # The prefix to use in the provisioning API endpoints.
  82. prefix: /_matrix/provision/v1
  83. # The shared secret to authorize users of the API.
  84. # Set to "generate" to generate and save a new token.
  85. shared_secret: generate
  86. # The unique ID of this appservice.
  87. id: telegram
  88. # Username of the appservice bot.
  89. bot_username: telegrambot
  90. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  91. # to leave display name/avatar as-is.
  92. bot_displayname: Telegram bridge bot
  93. bot_avatar: mxc://maunium.net/tJCRmUyJDsgRNgqhOgoiHWbX
  94. # Authentication tokens for AS <-> HS communication.
  95. as_token: "{{ matrix_mautrix_telegram_appservice_token }}"
  96. hs_token: "{{ matrix_mautrix_telegram_homeserver_token }}"
  97. # Bridge config
  98. bridge:
  99. # Localpart template of MXIDs for Telegram users.
  100. # {userid} is replaced with the user ID of the Telegram user.
  101. username_template: "telegram_{userid}"
  102. # Localpart template of room aliases for Telegram portal rooms.
  103. # {groupname} is replaced with the name part of the public channel/group invite link ( https://t.me/{} )
  104. alias_template: "telegram_{groupname}"
  105. # Displayname template for Telegram users.
  106. # {displayname} is replaced with the display name of the Telegram user.
  107. displayname_template: "{displayname} (Telegram)"
  108. # Set the preferred order of user identifiers which to use in the Matrix puppet display name.
  109. # In the (hopefully unlikely) scenario that none of the given keys are found, the numeric user
  110. # ID is used.
  111. #
  112. # If the bridge is working properly, a phone number or an username should always be known, but
  113. # the other one can very well be empty.
  114. #
  115. # Valid keys:
  116. # "full name" (First and/or last name)
  117. # "full name reversed" (Last and/or first name)
  118. # "first name"
  119. # "last name"
  120. # "username"
  121. # "phone number"
  122. displayname_preference:
  123. - full name
  124. - username
  125. - phone number
  126. # Maximum number of members to sync per portal when starting up. Other members will be
  127. # synced when they send messages. The maximum is 10000, after which the Telegram server
  128. # will not send any more members.
  129. # Defaults to no local limit (-> limited to 10000 by server)
  130. max_initial_member_sync: -1
  131. # Whether or not to sync the member list in channels.
  132. # If no channel admins have logged into the bridge, the bridge won't be able to sync the member
  133. # list regardless of this setting.
  134. sync_channel_members: true
  135. # Whether or not to skip deleted members when syncing members.
  136. skip_deleted_members: true
  137. # Whether or not to automatically synchronize contacts and chats of Matrix users logged into
  138. # their Telegram account at startup.
  139. startup_sync: true
  140. # Number of most recently active dialogs to check when syncing chats.
  141. # Dialogs include groups and private chats, but only groups are synced.
  142. # Set to 0 to remove limit.
  143. sync_dialog_limit: 30
  144. # The maximum number of simultaneous Telegram deletions to handle.
  145. # A large number of simultaneous redactions could put strain on your homeserver.
  146. max_telegram_delete: 10
  147. # Whether or not to automatically sync the Matrix room state (mostly unpuppeted displaynames)
  148. # at startup and when creating a bridge.
  149. sync_matrix_state: true
  150. # Allow logging in within Matrix. If false, the only way to log in is using the out-of-Matrix
  151. # login website (see appservice.public config section)
  152. allow_matrix_login: true
  153. # Whether or not to bridge plaintext highlights.
  154. # Only enable this if your displayname_template has some static part that the bridge can use to
  155. # reliably identify what is a plaintext highlight.
  156. plaintext_highlights: false
  157. # Show message editing as a reply to the original message.
  158. # If this is false, message edits are not shown at all, as Matrix does not support editing yet.
  159. edits_as_replies: true
  160. # Highlight changed/added parts in edits. Requires lxml.
  161. highlight_edits: false
  162. # Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix.
  163. public_portals: true
  164. # Whether or not to fetch and handle Telegram updates at startup from the time the bridge was down.
  165. # Currently only works for private chats and normal groups.
  166. catch_up: false
  167. # Whether or not to use /sync to get presence, read receipts and typing notifications when using
  168. # your own Matrix account as the Matrix puppet for your Telegram account.
  169. sync_with_custom_puppets: true
  170. # Set to false to disable link previews in messages sent to Telegram.
  171. telegram_link_preview: true
  172. # Use inline images instead of a separate message for the caption.
  173. # N.B. Inline images are not supported on all clients (e.g. Riot iOS).
  174. inline_images: false
  175. # Maximum size of image in megabytes before sending to Telegram as a document.
  176. image_as_file_size: 10
  177. # Whether to bridge Telegram bot messages as m.notices or m.texts.
  178. bot_messages_as_notices: true
  179. bridge_notices:
  180. # Whether or not Matrix bot messages (type m.notice) should be bridged.
  181. default: false
  182. # List of user IDs for whom the previous flag is flipped.
  183. # e.g. if bridge_notices.default is false, notices from other users will not be bridged, but
  184. # notices from users listed here will be bridged.
  185. exceptions: []
  186. # Some config options related to Telegram message deduplication.
  187. # The default values are usually fine, but some debug messages/warnings might recommend you
  188. # change these.
  189. deduplication:
  190. # Whether or not to check the database if the message about to be sent is a duplicate.
  191. pre_db_check: false
  192. # The number of latest events to keep when checking for duplicates.
  193. # You might need to increase this on high-traffic bridge instances.
  194. cache_queue_length: 20
  195. # The formats to use when sending messages to Telegram via the relay bot.
  196. #
  197. # Telegram doesn't have built-in emotes, so the m.emote format is also used for non-relaybot users.
  198. #
  199. # Available variables:
  200. # $sender_displayname - The display name of the sender (e.g. Example User)
  201. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  202. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  203. # $message - The message content as HTML
  204. message_formats:
  205. m.text: "<b>$sender_displayname</b>: $message"
  206. m.emote: "* <b>$sender_displayname</b> $message"
  207. m.file: "<b>$sender_displayname</b> sent a file: $message"
  208. m.image: "<b>$sender_displayname</b> sent an image: $message"
  209. m.audio: "<b>$sender_displayname</b> sent an audio file: $message"
  210. m.video: "<b>$sender_displayname</b> sent a video: $message"
  211. m.location: "<b>$sender_displayname</b> sent a location: $message"
  212. # The formats to use when sending state events to Telegram via the relay bot.
  213. #
  214. # Variables from `message_formats` that have the `sender_` prefix are available without the prefix.
  215. # In name_change events, `$prev_displayname` is the previous displayname.
  216. #
  217. # Set format to an empty string to disable the messages for that event.
  218. state_event_formats:
  219. join: "<b>$displayname</b> joined the room."
  220. leave: "<b>$displayname</b> left the room."
  221. name_change: "<b>$prev_displayname</b> changed their name to <b>$displayname</b>"
  222. # Filter rooms that can/can't be bridged. Can also be managed using the `filter` and
  223. # `filter-mode` management commands.
  224. #
  225. # Filters do not affect direct chats.
  226. # An empty blacklist will essentially disable the filter.
  227. filter:
  228. # Filter mode to use. Either "blacklist" or "whitelist".
  229. # If the mode is "blacklist", the listed chats will never be bridged.
  230. # If the mode is "whitelist", only the listed chats can be bridged.
  231. mode: blacklist
  232. # The list of group/channel IDs to filter.
  233. list: []
  234. # The prefix for commands. Only required in non-management rooms.
  235. command_prefix: "!tg"
  236. # Permissions for using the bridge.
  237. # Permitted values:
  238. # relaybot - Only use the bridge via the relaybot, no access to commands.
  239. # user - Relaybot level + access to commands to create bridges.
  240. # puppeting - User level + logging in with a Telegram account.
  241. # full - Full access to use the bridge, i.e. previous levels + Matrix login.
  242. # admin - Full access to use the bridge and some extra administration commands.
  243. # Permitted keys:
  244. # * - All Matrix users
  245. # domain - All users on that homeserver
  246. # mxid - Specific user
  247. permissions:
  248. '{{ matrix_mautrix_telegram_homeserver_domain }}': full
  249. # Options related to the message relay Telegram bot.
  250. relaybot:
  251. # Whether or not to allow creating portals from Telegram.
  252. authless_portals: true
  253. # Whether or not to allow Telegram group admins to use the bot commands.
  254. whitelist_group_admins: true
  255. # Whether or not to ignore incoming events sent by the relay bot.
  256. ignore_own_incoming_events: true
  257. # List of usernames/user IDs who are also allowed to use the bot commands.
  258. whitelist: []
  259. # Telegram config
  260. telegram:
  261. # Get your own API keys at https://my.telegram.org/apps
  262. api_id: {{ matrix_mautrix_telegram_api_id }}
  263. api_hash: {{ matrix_mautrix_telegram_api_hash }}
  264. # (Optional) Create your own bot at https://t.me/BotFather
  265. bot_token: disabled
  266. # Custom server to connect to.
  267. server:
  268. # Set to true to use these server settings. If false, will automatically
  269. # use production server assigned by Telegram. Set to false in production.
  270. enabled: false
  271. # The DC ID to connect to.
  272. dc: 2
  273. # The IP to connect to.
  274. ip: 149.154.167.40
  275. # The port to connect to. 443 may not work, 80 is better and both are equally secure.
  276. port: 80
  277. # Telethon proxy configuration.
  278. # You must install PySocks from pip for proxies to work.
  279. proxy:
  280. # Allowed types: disabled, socks4, socks5, http
  281. type: disabled
  282. # Proxy IP address and port.
  283. address: 127.0.0.1
  284. port: 1080
  285. # Whether or not to perform DNS resolving remotely.
  286. rdns: true
  287. # Proxy authentication (optional).
  288. username: ""
  289. password: ""
  290. # Python logging configuration.
  291. #
  292. # See section 16.7.2 of the Python documentation for more info:
  293. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  294. logging:
  295. version: 1
  296. formatters:
  297. precise:
  298. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  299. handlers:
  300. console:
  301. class: logging.StreamHandler
  302. formatter: precise
  303. loggers:
  304. mau:
  305. level: DEBUG
  306. telethon:
  307. level: DEBUG
  308. aiohttp:
  309. level: INFO
  310. root:
  311. level: DEBUG
  312. handlers: [console]
  313. matrix_mautrix_telegram_configuration_extension_yaml: |
  314. # Your custom YAML configuration goes here.
  315. # This configuration extends the default starting configuration (`matrix_mautrix_telegram_configuration_yaml`).
  316. #
  317. # You can override individual variables from the default configuration, or introduce new ones.
  318. #
  319. # If you need something more special, you can take full control by
  320. # completely redefining `matrix_mautrix_telegram_configuration_yaml`.
  321. matrix_mautrix_telegram_configuration_extension: "{{ matrix_mautrix_telegram_configuration_extension_yaml|from_yaml if matrix_mautrix_telegram_configuration_extension_yaml|from_yaml is mapping else {} }}"
  322. # Holds the final configuration (a combination of the default and its extension).
  323. # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_telegram_configuration_yaml`.
  324. matrix_mautrix_telegram_configuration: "{{ matrix_mautrix_telegram_configuration_yaml|from_yaml|combine(matrix_mautrix_telegram_configuration_extension, recursive=True) }}"
  325. matrix_mautrix_telegram_registration_yaml: |
  326. id: telegram
  327. as_token: "{{ matrix_mautrix_telegram_appservice_token }}"
  328. hs_token: "{{ matrix_mautrix_telegram_homeserver_token }}"
  329. namespaces:
  330. users:
  331. - exclusive: true
  332. regex: '@telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain }}'
  333. aliases:
  334. - exclusive: true
  335. regex: '#telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain }}'
  336. url: {{ matrix_mautrix_telegram_appservice_address }}
  337. sender_localpart: telegrambot
  338. rate_limited: false
  339. matrix_mautrix_telegram_registration: "{{ matrix_mautrix_telegram_registration_yaml|from_yaml }}"