homeserver:
    address: ${node.metadata['mautrix-whatsapp']['homeserver']['url']}
    domain: ${node.metadata['mautrix-whatsapp']['homeserver']['domain']}

appservice:
    address: http://${node.metadata['mautrix-whatsapp'].get('listen-addr', '127.0.0.1')}:${node.metadata['mautrix-whatsapp'].get('port', 20020)}
    hostname: ${node.metadata['mautrix-whatsapp'].get('listen-addr', '127.0.0.1')}
    port: ${node.metadata['mautrix-whatsapp'].get('port', 20020)}
    database:
        type: postgres
        uri: postgres://${node.metadata['mautrix-whatsapp']['database']['user']}:${node.metadata['mautrix-whatsapp']['database']['password']}@${node.metadata['mautrix-whatsapp']['database'].get('host', 'localhost')}/${node.metadata['mautrix-whatsapp']['database']['database']}?sslmode=disable
        max_open_conns: 20
        max_idle_conns: 2
    provisioning:
        prefix: /_matrix/provision/v1
% if node.metadata['mautrix-whatsapp']['provisioning']['enabled']:
        shared_secret: ${node.metadata['mautrix-whatsapp']['provisioning']['shared_secret']}
% else:
        shared_secret: disable
% endif
    id: whatsapp
    bot:
        username: whatsappbot
        displayname: WhatsApp bridge bot
        avatar: mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr
    as_token: ${node.metadata['mautrix-whatsapp']['as_token']}
    hs_token: ${node.metadata['mautrix-whatsapp']['hs_token']}

metrics:
    enabled: false
    listen: 127.0.0.1:8001

whatsapp:
    os_name: Mautrix-WhatsApp bridge
    browser_name: mx-wa

bridge:
    username_template: whatsapp_{{.}}
    displayname_template: "{{if .Notify}}{{.Notify}}{{else}}{{.Jid}}{{end}} (WhatsApp)"
    community_template: whatsapp_{{.Localpart}}={{.Server}}
    connection_timeout: 20
    fetch_message_on_timeout: false
    delivery_receipts: true
    login_qr_regen_count: 2
    max_connection_attempts: 3
    connection_retry_delay: -1
    report_connection_retry: true
    chat_list_wait: 30
    portal_sync_wait: 600
    user_message_buffer: 1024
    portal_message_buffer: 128
    call_notices:
        start: true
        end: true
    initial_chat_sync_count: 20
    initial_history_fill_count: 50
    initial_history_disable_notifications: false
    recovery_chat_sync_limit: -1
    recovery_history_backfill: true
    sync_max_chat_age: ${node.metadata['mautrix-whatsapp'].get('sync_max_days', 7)*24*60*60}
    sync_with_custom_puppets: true
    sync_direct_chat_list: false
    default_bridge_receipts: true
    default_bridge_presence: true
    login_shared_secret: null
    invite_own_puppet_for_backfilling: true
    private_chat_portal_meta: false
    resend_bridge_info: false
    whatsapp_thumbnail: false
    allow_user_invite: false
    command_prefix: "!wa"
    encryption:
        allow: false # requires login_shared_secret to be set
        default: false
        key_sharing:
            allow: false
            require_cross_signing: false
            require_verification: true
    permissions:
% for user, permission in node.metadata['mautrix-whatsapp']['permissions'].items():
        ${user}: ${permission}
% endfor
    relaybot:
        enabled: false
        management: "!whatsapp-relaybot:${node.metadata['mautrix-whatsapp']['homeserver']['domain']}"
        invites:
% for user, permission in node.metadata['mautrix-whatsapp']['permissions'].items():
%     if permission > 50:
            - ${user}
%     endif
% endfor
        message_formats:
            m.text: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
            m.notice: "<b>{{ .Sender.Displayname }}</b>: {{ .Message }}"
            m.emote: "* <b>{{ .Sender.Displayname }}</b> {{ .Message }}"
            m.file: "<b>{{ .Sender.Displayname }}</b> sent a file"
            m.image: "<b>{{ .Sender.Displayname }}</b> sent an image"
            m.audio: "<b>{{ .Sender.Displayname }}</b> sent an audio file"
            m.video: "<b>{{ .Sender.Displayname }}</b> sent a video"
            m.location: "<b>{{ .Sender.Displayname }}</b> sent a location"

logging:
    directory: /opt/mautrix-whatsapp/logs
    file_name_format: null
    file_date_format: 2006-01-02
    file_mode: 0600
    timestamp_format: null
    print_level: info
