# vim:ft=yaml
---
# For more information on how to configure Synapse, including a complete accounting of
# each option, go to
# https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html
# For the original version of this file go to
# https://github.com/element-hq/synapse/blob/master/docker/conf/homeserver.yaml

server_name: "{{ SYNAPSE_SERVER_NAME }}"
pid_file: /homeserver.pid
web_client: false
soft_file_limit: 0
log_config: "{{ SYNAPSE_LOG_CONFIG }}"
admin_contact: "{{ SYNAPSE_ADMIN_CONTACT }}"
registration_shared_secret: "{{ SYNAPSE_REGISTRATION_SHARED_SECRET }}"
enable_registration: false

## Ports ##

listeners:
  - port: {{ SYNAPSE_HTTP_PORT or 8008 }}
    tls: false
    bind_addresses: ['::']
    type: http
    x_forwarded: true
    resources:
      - names: [client]
        compress: true
      - names: [federation]
        compress: false

## Database ##

database:
  name: "psycopg2"
  args:
    user: '{{ POSTGRES_USER or "synapse" }}'
    password: '{{ POSTGRES_PASSWORD }}'
    database: '{{ POSTGRES_DB or "synapse" }}'
    host: '{{ POSTGRES_HOST or "db" }}'
    port: '{{ POSTGRES_PORT or "5432" }}'
    cp_min: {{ POSTGRES_CP_MIN or 5 }}
    cp_max: {{ POSTGRES_CP_MAX or 10 }}

## email ##

email:
  notif_from: "Your Friendly %(app)s homeserver <noreply@{{ SYNAPSE_SERVER_NAME }}>"
  smtp_host: "{{ SYNAPSE_SMTP_HOST }}"
  smtp_pass: "{{ SYNAPSE_SMTP_PASS }}"
  smtp_port: "{{ SYNAPSE_SMTP_PORT }}"
  smtp_user: "{{ SYNAPSE_SMTP_USER }}"

## Performance ##

event_cache_size: '{{ SYNAPSE_EVENT_CACHE_SIZE or "10K" }}'

## Ratelimiting ##

rc_messages_per_second: 0.2
rc_message_burst_count: 10.0
federation_rc_window_size: 1000
federation_rc_sleep_limit: 10
federation_rc_sleep_delay: 500
federation_rc_reject_limit: 50
federation_rc_concurrent: 3

## Files ##

media_store_path: "/data/media"
max_upload_size: '{{ SYNAPSE_MAX_UPLOAD_SIZE or "50M" }}'
max_image_pixels: "32M"
dynamic_thumbnails: false

# List of thumbnail to precalculate when an image is uploaded.
thumbnail_sizes:
- width: 32
  height: 32
  method: crop
- width: 96
  height: 96
  method: crop
- width: 320
  height: 240
  method: scale
- width: 640
  height: 480
  method: scale
- width: 800
  height: 600
  method: scale

url_preview_enabled: false
max_spider_size: "10M"


## Metrics ###

enable_metrics: '{{ SYNAPSE_REPORT_STATS.lower() == "yes" }}'
report_stats: '{{ SYNAPSE_REPORT_STATS.lower() == "yes" }}'

## API Configuration ##

{% if SYNAPSE_APPSERVICES %}
app_service_config_files:
{% for appservice in SYNAPSE_APPSERVICES %}
    - "{{ appservice }}"
{% endfor %}
{% endif %}

macaroon_secret_key: "{{ SYNAPSE_MACAROON_SECRET_KEY }}"
expire_access_token: false

## Signing Keys ##

signing_key_path: "/conf/{{ SYNAPSE_SERVER_NAME }}.signing.key"
old_signing_keys: {}
key_refresh_interval: "1d" # 1 Day.

# The trusted servers to download signing keys from.
suppress_key_server_warning: true
trusted_key_servers:
  - server_name: matrix.org
    verify_keys:
      "ed25519:auto": "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw"  # pragma: allowlist secret

password_config:
   enabled: true

modules:
  - module: "ldap_auth_provider.LdapAuthProviderModule"
    config:
      enabled: true
      uri: '{{ LDAP_URI or "ldapi:///run/slapd/ldapi" }}'
      start_tls: {{ LDAP_TLS or False }}
      base: '{{ LDAP_BASE_DN or "ou=People,dc=shore,dc=co,dc=il" }}'
      attributes:
        uid: "cn"
        mail: "mail"
        name: "givenName"
