lib/rabbit_feed/configuration.rb in rabbit_feed-2.3.6 vs lib/rabbit_feed/configuration.rb in rabbit_feed-2.3.7

- old
+ new

@@ -1,10 +1,11 @@ module RabbitFeed class Configuration include ActiveModel::Validations - attr_reader :host, :hosts, :port, :user, :password, :application, :environment, :exchange, :heartbeat, :connect_timeout, :network_recovery_interval, :auto_delete_queue, :auto_delete_exchange + attr_reader :host, :hosts, :port, :user, :password, :application, :environment, :exchange, :heartbeat, + :connect_timeout, :network_recovery_interval, :auto_delete_queue, :auto_delete_exchange validates_presence_of :application, :environment, :exchange def initialize options RabbitFeed.log.info {{ event: :initialize_configuration, options: options.merge({password: :redacted}) }} @@ -19,10 +20,11 @@ @network_recovery_interval = options[:network_recovery_interval] @auto_delete_queue = !!(options[:auto_delete_queue] || false) @auto_delete_exchange = !!(options[:auto_delete_exchange] || false) @application = options[:application] @environment = options[:environment] + @route_prefix_extension = options[:route_prefix_extension] validate! end def self.load file_path, environment, application RabbitFeed.log.info {{ event: :load_configuration_file, file_path: file_path, environment: environment, application: application }} @@ -33,11 +35,15 @@ options[:environment] = environment options[:application] ||= application new options end + def route_prefix_extension + ".#{@route_prefix_extension}" unless @route_prefix_extension.blank? + end + def queue - "#{environment}.#{application}" + "#{environment}#{route_prefix_extension}.#{application}" end def connection_options Hash.new.tap do |options| options[:heartbeat] = heartbeat if heartbeat