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

publish_exchange = "amq.topic"
passive_declares = true

callback = "mirror_from_pagure_bus:MirrorFromPagure"

# Don't use topic_prefix, since outgoing message topics are derived from incoming messages.
# topic_prefix = ""

[[bindings]]
{% if inventory_hostname.startswith('batcave01.iad2') %}
queue = "mirror_pagure_ansible{{ env_suffix }}"
{% elif inventory_hostname.startswith('batcave13.') %}
queue = "mirror_pagure_ansible{{ env_suffix }}_13"
{% endif %}
exchange = "amq.topic"
routing_keys = [
    "io.pagure.*.pagure.git.receive",
]

[tls]
ca_cert = "/etc/pki/fedora-messaging/cacert.pem"
keyfile = "/etc/pki/fedora-messaging/mirror_pagure_ansible.key"
certfile = "/etc/pki/fedora-messaging/mirror_pagure_ansible.crt"

[client_properties]
app = "mirror_from_pagure"
app_url = "https://pagure.io/fedora-infra/mirror_from_pagure"
app_contacts_email = ["pingou@fedoraproject.org"]

{% if inventory_hostname.startswith('batcave01.iad2') %}
[queues."mirror_pagure_ansible{{ env_suffix }}"]
{% elif inventory_hostname.startswith('batcave13.') %}
[queues."mirror_pagure_ansible{{ env_suffix }}_13"]
{% endif %}
durable = true
auto_delete = false
exclusive = false
arguments = {}

[consumer_config]
mirror_folder = "/srv/git/mirrors/"
trigger_names = ["fedora-infra/ansible"]
urls = [
    "https://pagure.io/fedora-infra/ansible.git",
]

[qos]
prefetch_size = 0
prefetch_count = 25

[log_config]
version = 1
disable_existing_loggers = true

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

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

[log_config.loggers.fedora_messaging]
level = "INFO"
propagate = false
handlers = ["console"]

[log_config.loggers.twisted]
level = "INFO"
propagate = false
handlers = ["console"]

[log_config.loggers.pika]
level = "WARNING"
propagate = false
handlers = ["console"]

# If your consumer sets up a logger, you must add a configuration for it
# here in order for the messages to show up. e.g. if it set up a logger
# called 'example_printer', you could do:
[log_config.loggers.mirror_from_pagure_bus]
level = "DEBUG"
propagate = false
handlers = ["console"]

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