Skip to content

Commit

Permalink
[api] Make RabbitMQ message bus queues to be co...
Browse files Browse the repository at this point in the history
...nfigurable (Thanks git-cop).

We have plenty of users and customers that host their own OBS instance.
This change allows them to distunguish RabbitMQ messages from different
hosts by adding a custom prefix.
  • Loading branch information
bgeuken committed Oct 5, 2017
1 parent 4d25923 commit 46d7be9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/api/app/models/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def ldap_enabled?
CONFIG['ldap_mode'] == :on
end

def amqp_namespace
CONFIG['amqp_namespace'] || 'opensuse.obs'
end

def passwords_changable?
change_password && CONFIG['proxy_auth_mode'] != :on && CONFIG['ldap_mode'] != :on
end
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/models/event/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Event::CommentForProject < ::Event::Project
after_commit :send_to_bus

def self.message_bus_queue
'opensuse.obs.project.comment'
"#{Configuration.amqp_namespace}.project.comment"
end

self.description = 'New comment for project created'
Expand All @@ -51,7 +51,7 @@ class Event::CommentForPackage < ::Event::Package
after_commit :send_to_bus

def self.message_bus_queue
'opensuse.obs.package.comment'
"#{Configuration.amqp_namespace}.package.comment"
end

self.description = 'New comment for package created'
Expand Down
3 changes: 3 additions & 0 deletions src/api/config/options.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ backup_port: 22

# Rabbitmq based message bus
#
# Prefix of the message bus rooting key
# amqp_namespace: 'opensuse.obs'
#
# Connection options -> http://rubybunny.info/articles/connecting.html
# amqp_options:
# host: rabbit.example.com
Expand Down

0 comments on commit 46d7be9

Please sign in to comment.