Files
ansible-matrix/roles/extras/templates/config/mautrix-bridge.yaml.j2
2023-04-19 01:45:05 +03:00

129 lines
3.5 KiB
Django/Jinja

# {{ ansible_managed }}
{% set bridge_service = matrix_extra | replace('mautrix-','') %}
homeserver:
address: http://localhost:8009
domain: {{ matrix_domain }}
appservice:
address: http://localhost:{{ mautrix_port }}
hostname: localhost
port: {{ mautrix_port }}
database: postgres://{{ psql_dbs[matrix_extra]['user'] }}:{{ psql_dbs[matrix_extra]['password']|urlencode() }}@localhost/{{ matrix_extra }}
{% if 'public' in mautrix_blocks %}
public:
enabled: true
prefix: /{{ bridge_service }}
external: {{ matrix_external_url }}/{{ bridge_service }}
{% if not 'provisioning' in mautrix_blocks %}
shared_secret: null
{% endif %}
{% endif %}
{% if 'provisioning' in mautrix_blocks %}
provisioning:
enabled: false
shared_secret: null
{% endif %}
bot_displayname: {{ bridge_service | capitalize }} {{ matrix_bridge_name_suffix }}
ephemeral_events: {{ matrix_bridge_ephemeral_events }}
# FIXME Prometheus telemetry config. Requires prometheus-client to be installed.
metrics:
enabled: false
listen_port: 8000
bridge:
{% if 'displayname_template' in mautrix_blocks %}
displayname_template: '{displayname}'
{% endif %}
sync_with_custom_puppets: {{ not matrix_bridge_ephemeral_events }}
sync_direct_chat_list: true
double_puppet_server_map:
{{ matrix_domain }}: {{ matrix_external_url }}
double_puppet_allow_discovery: true
# FIXME Support other_homeservers
login_shared_secret_map:
{{ matrix_domain }}: "{{ synapse_shared_secret_auth }}"
{% if matrix_extra_other_homeserver_shared_secret_auth is defined %}
{% for item in matrix_extra_other_homeserver_shared_secret_auth | dict2items %}
{{ item.key }}: "{{ item.value }}"
{% endfor %}
{% endif %}
encryption:
allow: true
default: {{ mautrix_default_encrypt }}
delivery_receipts: true
{% if 'delivery_error_reports' in mautrix_blocks %}
delivery_error_reports: true
{% endif %}
{% if 'backfill' in mautrix_blocks %}
backfill:
{% block backfill %}
invite_own_puppet: true
initial_limit: 1000
missed_limit: 5000
{% endblock backfill %}
{% endif %}
permissions:
'*': {{ mautrix_permissions.relay }}
{{ matrix_domain }}: {{ mautrix_permissions.user }}
{% if matrix_bridge_other_homeservers is defined %}
{% for item in matrix_bridge_other_homeservers %}
{{ item }}: {{ mautrix_permissions.user }}
{% endfor %}
{% endif %}
{% if matrix_bridge_admins is defined %}
{% for item in matrix_bridge_admins %}
'{{ item }}': {{ mautrix_permissions.admin }}
{% endfor %}
{% endif %}
{% if 'relay' in mautrix_blocks %}
relay:
enabled: true
{% endif %}
{% block bridge %}{% endblock %}
{% block additional %}{% endblock %}
logging:
version: 1
formatters:
colored:
(): {{ matrix_extra | replace('-','_') }}.util.ColorFormatter
format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
normal:
format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
handlers:
file:
class: logging.handlers.RotatingFileHandler
formatter: normal
filename: ./{{ matrix_extra }}.log
maxBytes: 10485760
backupCount: 10
console:
class: logging.StreamHandler
formatter: colored
loggers:
{% for logger in mautrix_loggers %}
{{ logger }}:
level: INFO
{% endfor %}
root:
level: INFO
handlers: [file,console]