# {{ ansible_managed }}
server_name: "{{ docker_synapse_server_name }}"
pid_file: /data/homeserver.pid
listeners:
  - port: 8008
    tls: false
    type: http
    x_forwarded: true
    resources:
      - names: [client, federation]
        compress: false

database:
  name: psycopg2
  args:
    host: db
    database: {{ docker_synapse_db_name }}
    user: {{ docker_synapse_db_user }}
    password: {{ docker_synapse_db_password }}
    cp_min: 5
    cp_max: 10

log_config: "/data/{{ docker_synapse_server_name }}.log.config"
media_store_path: /data/media_store
registration_shared_secret: "{{ docker_synapse_registration_shared_secret }}"
report_stats: false
macaroon_secret_key: "{{ docker_synapse_macaroon_secret_key }}"
form_secret: "{{ docker_synapse_form_secret }}"
signing_key_path: "/data/{{ docker_synapse_server_name }}.signing.key"
trusted_key_servers:
  - server_name: "matrix.org"

{% if docker_synapse_oidc_enabled is true %}
oidc_providers:
  - idp_id: {{ docker_synapse_oidc_idp_id }}
    idp_name: "{{ docker_synapse_oidc_idp_name }}"
    issuer: "{{ docker_synapse_oidc_issuer }}"
    client_id: "{{ docker_synapse_oidc_client_id }}"
    client_secret: "{{ docker_synapse_oidc_client_secret }}"
    scopes: {{ docker_synapse_oidc_scopes }}
    user_mapping_provider:
      config:
        localpart_template: "{{ "{{ user.preferred_username }}" }}"
        display_name_template: "{{ "{{ user.name }}" }}"

password_config:
   enabled: "{{ docker_synapse_password_config_enabled }}"
{% endif %}


{% if docker_synapse_smtp_enabled is true %}
email:
  smtp_host: "{{ docker_synapse_smtp_host }}"
  smtp_port: "{{ docker_synapse_smtp_port }}"
{% if docker_synapse_smtp_user is defined %}
  smtp_user: "{{ docker_synapse_smtp_user }}"
  smtp_pass: "{{ docker_synapse_smtp_password }}"
{% endif %}
  notif_from: "{{ docker_synapse_smtp_from }}"
  enable_notifs: true
  notif_for_new_users: false
  invite_client_location: "{{ docker_synapse_smtp_invite_url }}"
  app_name: "{{ docker_synapse_smtp_app_name }}"


  subjects:
    message_from_person_in_room: "[%(app)s] Vous avez un message sur %(app)s de %(person)s dans le canal %(room)s..."
    message_from_person: "[%(app)s] Vous avez un message sur %(app)s de %(person)s..."
    messages_from_person: "[%(app)s] Vous avez des messages sur %(app)s de %(person)s..."
    messages_in_room: "[%(app)s] Vous avez des messages sur %(app)s dans le canal %(room)s..."
    messages_in_room_and_others: "[%(app)s] Vous avez des messages sur %(app)s dans le canal %(room)s et autres canaux..."
    messages_from_person_and_others: "[%(app)s] Vous avez des messages sur %(app)s de %(person)s et autres personnes..."
    invite_from_person_to_room: "[%(app)s] %(person)s vous a invité à rejoindre le canal %(room)s sur %(app)s..."
    invite_from_person: "[%(app)s] %(person)s vous a invité à discuter sur %(app)s..."
    password_reset: "[%(server_name)s] Mot de passe réinitialisé"
    email_validation: "[%(server_name)s] Validez votre adresse de courriel"
{% endif %}

{% if docker_synapse_retention_options is defined %}
retention: {{ docker_synapse_retention_options | combine({ 'enabled': true }) }} 
{% endif %}


{% if docker_synapse_turn_uris is defined %}
# coturn configuration
turn_uris: {{ docker_synapse_turn_uris }}
turn_shared_secret: "{{ docker_synapse_turn_shared_secret }}"
turn_user_lifetime: 86400000
turn_allow_guests: True
{% endif %}