# FlowKraft AI Crew - Matrix Synapse Configuration
# Configured for localhost development with no federation

# Server name - localhost for local development
# This is the domain that will appear in user MXIDs (@user:localhost)
server_name: "localhost"
pid_file: "/data/homeserver.pid"
report_stats: no

# Postgres DB (points to the matrix-synapsedb-postgres container)
# Using hardcoded dev values - these match docker-compose defaults
database:
  name: psycopg2
  args:
    user: "synapse"
    password: "synapse"
    database: matrix-synapsedb
    host: flowkraft-ai-hub-matrix-db
    port: 5432
    cp_min: 5
    cp_max: 10

# Paths inside the container (mapped to Docker volumes)
data_dir: "/data"
media_store_path: "/data/media_store"
uploads_path: "/data/uploads"

# Secrets (generate fresh 32-byte hex strings for production)
# These are dev defaults - replace in production with: openssl rand -hex 32
macaroon_secret_key: "5297f0fb78a2494fb984c513a90ac7606063302b23504b898d0b5d6de8771166"
registration_shared_secret: "6180e53cc7b443e691d1bfc93c83bf2d60c8ee90a0db4bb194d74db52dd6f6cd"

# Signing key path - Synapse will auto-generate if missing
signing_key_path: "/data/localhost.signing.key"

# Logging
log_config: "/data/log.config"

# Enable user registration for localhost development
# Users can self-register to test the chat functionality
enable_registration: true
enable_registration_without_verification: true

# Allow password login (needed for Baibot and test users)
password_config:
  enabled: true

# Listener configuration
# Federation is DISABLED for local development (only client API)
listeners:
  - port: 8008
    bind_addresses: ['0.0.0.0']
    type: http
    tls: false
    x_forwarded: false
    resources:
      - names: [client]  # Only client API, NO federation
        compress: false

# Explicitly disable outbound federation
# Empty whitelist = not allowed to federate with anyone
federation_domain_whitelist: []

# Remove trusted key servers since we're not federating
trusted_key_servers: []
suppress_key_server_warning: true

# Disable metrics for local development
metrics:
  enabled: false

# Media configuration
max_upload_size: 50M
media_retention:
  local_media_lifetime: 90d
  remote_media_lifetime: 14d

# Presence configuration (optional - disable for performance)
presence:
  enabled: true

# URL preview configuration (optional)
url_preview_enabled: false

# Allow guest access for easier testing
allow_guest_access: true

# Public room directory
allow_public_rooms_without_auth: true
allow_public_rooms_over_federation: false

# Retention policy
retention:
  enabled: false

# Disable rate limiting for local development
# Prevents provisioning failures when creating multiple rooms rapidly
rc_message:
  per_second: 1000
  burst_count: 1000
rc_registration:
  per_second: 1000
  burst_count: 1000
rc_login:
  address:
    per_second: 1000
    burst_count: 1000
  account:
    per_second: 1000
    burst_count: 1000
rc_admin_redaction:
  per_second: 1000
  burst_count: 1000
rc_joins:
  local:
    per_second: 1000
    burst_count: 1000
  remote:
    per_second: 1000
    burst_count: 1000
rc_invites:
  per_room:
    per_second: 1000
    burst_count: 1000
  per_user:
    per_second: 1000
    burst_count: 1000
