# A sample configuration for fedora-messaging. This file is in the TOML format.
# For complete details on all configuration options, see the documentation
# https://fedora-messaging.readthedocs.io/en/latest/configuration.html.

amqp_url = "amqps://greenwave{{ env_suffix }}:@rabbitmq{{ env_suffix }}.fedoraproject.org/%2Fpubsub"

{% if env == "staging" %}
topic_prefix = "org.fedoraproject.stg"
{% else %}
topic_prefix = "org.fedoraproject.prod"
{% endif %}

publish_exchange = "amq.topic"
passive_declares = true

callback = "greenwave.consumers.fedora_messaging_consumer:fedora_messaging_callback"

# Note the double brackets below.
# To add another binding, add another [[bindings]] section.
[[bindings]]
queue = "greenwave{{ env_suffix }}"
exchange = "amq.topic"
routing_keys = [
    "org.fedoraproject.*.resultsdb.result.new",
    "org.fedoraproject.*.waiverdb.waiver.new",
]

[tls]
ca_cert = "/etc/pki/rabbitmq/ca/greenwave.ca"
keyfile = "/etc/pki/rabbitmq/key/greenwave.key"
certfile = "/etc/pki/rabbitmq/crt/greenwave.crt"

[client_properties]
app = "greenwave"

[queues."greenwave{{ env_suffix }}"]
durable = true
auto_delete = false
exclusive = false
arguments = {}

[qos]
prefetch_size = 0
prefetch_count = 25

[log_config]
version = 1
disable_existing_loggers = true

[log_config.formatters.simple]
format = "[%(name)s %(levelname)s] %(message)s"

[log_config.handlers.console]
class = "logging.StreamHandler"
formatter = "simple"
stream = "ext://sys.stdout"

[log_config.loggers.fedora_messaging]
{% if env == "staging" %}
level = "DEBUG"
{% else %}
level = "INFO"
{% endif %}
propagate = false
handlers = ["console"]

[log_config.root]
level = "DEBUG"
handlers = ["console"]

# greenwave consumer configuration
[consumer_config]
topic_prefix = 'org.fedoraproject'
environment = '{{ env }}'
waiverdb_topic_suffix = 'waiver.new'
resultsdb_topic_suffix = 'resultsdb.result.new'
