# SPDX-FileCopyrightText: 2022 - 2024 Nikita Chernyi
# SPDX-FileCopyrightText: 2022 - 2025 Slavi Pantaleev
# SPDX-FileCopyrightText: 2023 Luke D Iremadze
# SPDX-FileCopyrightText: 2023 Samuel Meenzen
# SPDX-FileCopyrightText: 2024 - 2025 Suguru Hirahara
#
# SPDX-License-Identifier: AGPL-3.0-or-later

---
# postmoogle is an email to Matrix bridge using its bot user
# Project source code URL: https://github.com/etkecc/postmoogle

matrix_postmoogle_enabled: true

matrix_postmoogle_container_image_self_build: false
matrix_postmoogle_docker_repo: "https://github.com/etkecc/postmoogle.git"
matrix_postmoogle_docker_repo_version: "{{ 'main' if matrix_postmoogle_version == 'latest' else matrix_postmoogle_version }}"
matrix_postmoogle_docker_src_files_path: "{{ matrix_base_data_path }}/postmoogle/docker-src"

# renovate: datasource=docker depName=ghcr.io/etkecc/postmoogle
matrix_postmoogle_version: v0.9.27
matrix_postmoogle_docker_image: "{{ matrix_postmoogle_docker_image_registry_prefix }}etkecc/postmoogle:{{ matrix_postmoogle_version }}"
matrix_postmoogle_docker_image_registry_prefix: "{{ 'localhost/' if matrix_postmoogle_container_image_self_build else matrix_postmoogle_docker_image_registry_prefix_upstream }}"
matrix_postmoogle_docker_image_registry_prefix_upstream: "{{ matrix_postmoogle_docker_image_registry_prefix_upstream_default }}"
matrix_postmoogle_docker_image_registry_prefix_upstream_default: "ghcr.io/"
matrix_postmoogle_docker_image_force_pull: "{{ matrix_postmoogle_docker_image.endswith(':latest') }}"

matrix_postmoogle_base_path: "{{ matrix_base_data_path }}/postmoogle"
matrix_postmoogle_config_path: "{{ matrix_postmoogle_base_path }}/config"
matrix_postmoogle_data_path: "{{ matrix_postmoogle_base_path }}/data"

matrix_postmoogle_container_network: ""

matrix_postmoogle_container_additional_networks: "{{ matrix_postmoogle_container_additional_networks_auto + matrix_postmoogle_container_additional_networks_custom }}"
matrix_postmoogle_container_additional_networks_auto: []
matrix_postmoogle_container_additional_networks_custom: []

# A list of extra arguments to pass to the container
matrix_postmoogle_container_extra_arguments: []

# List of systemd services that matrix-postmoogle.service depends on
matrix_postmoogle_systemd_required_services_list: "{{ matrix_postmoogle_systemd_required_services_list_default + matrix_postmoogle_systemd_required_services_list_auto + matrix_postmoogle_systemd_required_services_list_custom }}"
matrix_postmoogle_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
matrix_postmoogle_systemd_required_services_list_auto: []
matrix_postmoogle_systemd_required_services_list_custom: []

# List of systemd services that matrix-postmoogle.service wants
matrix_postmoogle_systemd_wanted_services_list: []

# Database-related configuration fields.
#
# To use SQLite, stick to these defaults.
#
# To use Postgres:
# - change the engine (`matrix_postmoogle_database_engine: 'postgres'`)
# - adjust your database credentials via the `matrix_postmoogle_database_*` variables
matrix_postmoogle_database_engine: 'sqlite'

matrix_postmoogle_sqlite_database_path_local: "{{ matrix_postmoogle_data_path }}/bot.db"
matrix_postmoogle_sqlite_database_path_in_container: "/data/bot.db"

matrix_postmoogle_database_username: 'postmoogle'
matrix_postmoogle_database_password: 'some-password'
matrix_postmoogle_database_hostname: ''
matrix_postmoogle_database_port: 5432
matrix_postmoogle_database_name: 'postmoogle'
matrix_postmoogle_database_sslmode: disable

matrix_postmoogle_database_connection_string: 'postgres://{{ matrix_postmoogle_database_username }}:{{ matrix_postmoogle_database_password }}@{{ matrix_postmoogle_database_hostname }}:{{ matrix_postmoogle_database_port }}/{{ matrix_postmoogle_database_name }}?sslmode={{ matrix_postmoogle_database_sslmode }}'

matrix_postmoogle_storage_database: "{{
	{
		'sqlite': matrix_postmoogle_sqlite_database_path_in_container,
		'postgres': matrix_postmoogle_database_connection_string,
	}[matrix_postmoogle_database_engine]
}}"

matrix_postmoogle_database_dialect: "{{
  {
    'sqlite': 'sqlite3',
    'postgres': 'postgres',
  }[matrix_postmoogle_database_engine]
}}"


# The bot's username. This user needs to be created manually beforehand.
# Also see `matrix_postmoogle_password` or `matrix_postmoogle_sharedsecret`
matrix_postmoogle_login: "postmoogle"

# The password that the bot uses to authenticate.
matrix_postmoogle_password: ''

# Alternative to password - shared secret requires matrix_postmoogle_login to be MXID
matrix_postmoogle_sharedsecret: ''

matrix_postmoogle_homeserver: ""

# Command prefix
matrix_postmoogle_prefix: '!pm'

# Max email size in megabytes, including attachments
matrix_postmoogle_maxsize: '1024'

# Optional SMTP relay mode
matrix_postmoogle_relay_host: ''
matrix_postmoogle_relay_port: ''
matrix_postmoogle_relay_username: ''
matrix_postmoogle_relay_password: ''

# A list of admins
# Example set of rules:
# matrix_postmoogle_admins:
# - '@alice:example.com'
# - '@bob:example.com'
# - '@bot.*:example.com'
# - '@*:example.net'
matrix_postmoogle_admins: "{{ [matrix_admin] if matrix_admin else [] }}"

# Sentry DSN. Deprecated, use matrix_postmoogle_monitoring_sentry_dsn
matrix_postmoogle_sentry: ''

# Sentry integration
matrix_postmoogle_monitoring_sentry_dsn: "{{ matrix_postmoogle_sentry }}"
matrix_postmoogle_monitoring_sentry_rate: 20

# healthchecks.io integration
matrix_postmoogle_monitoring_healthchecks_uuid: ''
matrix_postmoogle_monitoring_healthchecks_duration: 60

# Log level
matrix_postmoogle_loglevel: 'INFO'

# deprecated, use matrix_postmoogle_domains
matrix_postmoogle_domain: "{{ matrix_server_fqn_matrix }}"

matrix_postmoogle_domains:
  - "{{ matrix_postmoogle_domain }}"  # backward compatibility

# Password (passphrase) to encrypt account data
matrix_postmoogle_data_secret: ""

# in-container ports
matrix_postmoogle_port: '2525'
matrix_postmoogle_tls_port: '25587'

# on-host ports
matrix_postmoogle_smtp_host_bind_port: '25'
matrix_postmoogle_submission_host_bind_port: '587'

### SSL
## on-host SSL dir
matrix_postmoogle_ssl_path: ""

## in-container SSL paths
# matrix_postmoogle_tls_cert is the SSL certificates' certificates.
# This var is likely set via group_vars/matrix_servers, so you don't need to set certs manually.
# If you do need to set it manually, note that this is an in-container path.
# To mount a certificates volumes into the container, use matrix_postmoogle_ssl_path
# Example value: /ssl/live/{{ matrix_postmoogle_domain }}/fullchain.pem
matrix_postmoogle_tls_cert: ""

# matrix_postmoogle_tls_key is the SSL certificates' keys.
# This var is likely set via group_vars/matrix_servers, so you don't need to set keys manually.
# If you do need to set it manually, note that this is an in-container path.
# To mount a certificates volumes into the container, use matrix_postmoogle_ssl_path
# Example value: /ssl/live/{{ matrix_postmoogle_domain }}/privkey.pem
matrix_postmoogle_tls_key: ""

# Mandatory TLS, even on plain SMTP port
matrix_postmoogle_tls_required: false

# trusted proxies
matrix_postmoogle_proxies: []

# known forwarders
matrix_postmoogle_mailboxes_forwarded: []

# reserved mailboxes
matrix_postmoogle_mailboxes_reserved: []

# mailbox activation flow
matrix_postmoogle_mailboxes_activation: none

# Additional environment variables to pass to the postmoogle container
#
# Example:
# matrix_postmoogle_environment_variables_extension: |
#   postmoogle_TEXT_DONE=Done
matrix_postmoogle_environment_variables_extension: ''
