Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

417 строки
20 KiB

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