# Configuration file for Synapse.
#
# This is a YAML file: see [1] for a quick introduction. Note in particular
# that *indentation is important*: all the elements of a list or dictionary
# should have the same indentation.
#
# [1] https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
#
# For more information on how to configure Synapse, including a complete accounting of
# each option, go to docs/usage/configuration/config_documentation.md or
# https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html
server_name: "starstruck.systems"
pid_file: /opt/synapse/data/homeserver.pid
listeners:
  - port: 8008
    tls: false
    type: http
    tag: http
    x_forwarded: true
    bind_addresses: ['0.0.0.0']
    resources:
      - names: [client, federation]
        compress: true  # reverse proxy is remote so compressing between origin <-> proxy is necessary

  - port: 9000
    type: metrics
    bind_addresses: ['0.0.0.0']

  - type: http
    tag: unix
    path: /opt/synapse/synapse.sock
    resources:
      - names: [client, federation, replication]
        compress: false

database:
  name: psycopg2
  args:
    user: # redacted
    password: # redacted
    dbname: # redacted
    host: 10.11.10.107
    cp_min: 2
    cp_max: 4

log_config: "/opt/synapse/config/starstruck.systems.log.config"
media_store_path: /opt/synapse/data/media_store
media_upload_limits:
  - time_period: 31d
    max_size: 1G

enable_registration: true
registration_requires_token: true
registration_shared_secret: # redacted
report_stats: false
form_secret: # redacted
signing_key_path: "/opt/synapse/config/starstruck.systems.signing.key"
auto_join_rooms:
  - '#space:nexy7574.co.uk'
  - '#general:nexy7574.co.uk'

enable_metrics: true
federation_metrics_domains:
  - matrix.org
  - nexy7574.co.uk
  - continuwuity.org
  - asgard.chat
  - codestorm.net
key_refresh_interval: 7d
federation:
  destination_min_retry_interval: 10s
  destination_retry_multiplier: 5
  destination_max_retry_interval: 1h
  spoil_servers: [] # redacted 
  spoil_users: [] # redacted

trusted_key_servers:
  - server_name: "maunium.net"
    verify_keys:
      ed25519:a_xxeS: lVt/CC3tv74OH6xTph2JrUmeRj/j+1q0HVa0Xf4QlCg
  - server_name: "codestorm.net"
    verify_keys:
      ed25519:a_oWiN: h0Ng85ZDujTl/T95ky6A9fLK9dpTLOSnOt7AnarZTr8
  - server_name: "unredacted.org"
    verify_keys:
      ed25519:a_wLAi: mz+O9Qx7wplpk9qxDYOt6ed+x0kaRg+K/Zm7DEknUnk
  - server_name: "tchncs.de"
    verify_keys:
      ed25519:9oQhk0: 0xNUfqk2+ply8l8OsRPPcnCP7bpokN66/XdG+Mk9nF0
      ed25519:a_liSe: 6SuyjT2sIp7mKWqisjv/GXtuMYZb7grX1KdhumJnc6I
      ed25519:a_hyvD: a/sCi6MsjnCZlhHY3aHEkSO+/0PGLhAj2jwfKusfRXk
  - server_name: "asgard.chat"
    verify_keys:
      ed25519:odin: VQ2l62k6PSJQnhPGGD3ydBfymTm+nW4XlgHXlDf6qkk
default_room_version: '12'
forgotten_room_retention_period: 1h
redaction_retention_period: 61d
max_event_delay_duration: 24h
max_upload_size: 50M
max_avatar_size: 5M
media_retention:
  remote_media_lifetime: 61d
url_preview_enabled: true
url_preview_ip_range_blacklist:
  - 127.0.0.0/8
  - 10.0.0.0/8
  - 172.16.0.0/12
  - 192.168.0.0/16
  - 100.64.0.0/10
  - 192.0.0.0/24
  - 169.254.0.0/16
  - 192.88.99.0/24
  - 198.18.0.0/15
  - 192.0.2.0/24
  - 198.51.100.0/24
  - 203.0.113.0/24
  - 224.0.0.0/4
  - ::1/128
  - fe80::/10
  - fc00::/7
  - 2001:db8::/32
  - ff00::/8
  - fec0::/10
room_list_publication_rules:
  - action: allow
forget_rooms_on_leave: true
presence:
  enabled: false
  include_offline_users_on_sync: false

app_service_config_files:
  - /opt/synapse/appservices/meowlnir.yaml
  - /opt/synapse/appservices/double-puppet.yaml

experimental_features:
  # MSC2815 (allow room moderators to view redacted event content)
  msc2815_enabled: true

  msc2409_to_device_messages_enabled: true
  msc3202_device_masquerading: true
  msc3202_transaction_extensions: true
  
  # MSC3266 (room summary api)
  msc3266_enabled: true
  # MSC4210: Remove legacy mentions
  msc4210_enabled: true
  # MSC4222: Adding `state_after` to sync v2
  msc4222_enabled: true
  # MSC4133: Custom profile fields
  msc4133_enabled: true
  # MSC3852: Expose last seen user agent field on /_matrix/client/v3/devices.
  msc3852_enabled: true
  # MSC4155: Invite filtering
  msc4155_enabled: true
  # MSC4293: Redact on Kick/Ban
  msc4293_enabled: true
  # MSC4267: Automatically forgetting rooms on leave
  msc4267_enabled: true
  # MSC3814 (dehydrated devices with SSSS)
  msc3814_enabled: true
  msc2697_enabled: false  # must be disabled to allow 3814 to be enabled
  # MSC2666 (query mutual rooms)
  msc2666_enabled: true
  # MSC4222: state_after
  msc4222_enabled: true

caches:
  global_factor: 1
  cache_autotuning:
    max_cache_memory_usage: 1024M
    target_cache_memory_usage: 512M
    min_cache_ttl: 10s
  per_cache_factors:
    get_current_hosts_in_room: 1
    get_local_users_in_room: 1
    get_rooms_for_user: 1
gc_thresholds:
  - 500
  - 10
  - 10

# Some ratelimits are a bit high
rc_message:
  per_second: 0.5  # default: 0.2
  burst_count: 30  # default: 10
rc_delayed_event_mgmt:  # for element call
  per_second: 1
  burst_count: 20
rc_invites:
  per_user:
    per_second: 1  # default: 0.003
    burst_count: 3  # default: 5

modules:
  - module: synapse_http_antispam.HTTPAntispam
    config:
      base_url: http://127.0.0.1:29339/_meowlnir/antispam/ #redacted
      authorization: # redacted
      enabled_callbacks:
        - user_may_invite
        - user_may_join_room

# Worker config
worker_replication_secret: #redacted
redis:
  enabled: true
federation_sender_instances:
  - fed-sender-1
  - fed-sender-2
instance_map:
  main:
    path: /opt/synapse/synapse.sock

# vim:ft=yaml
