Skip to content

Config is not being applied via YML files #20

Description

@brianbroderick

My Gemfile:

active_publisher (0.1.5)
  bunny (~> 2.1)
active_publisher (0.1.5-java)
  march_hare (~> 2.7)

I'm using JRuby 9.1.5.0.

Here is what the YML file looks like:

default: &default
  host: <%= ENV['RABBITMQ_HOST'] %>
  port: <%= ENV['RABBITMQ_PORT'] %>
  username: <%= ENV['RABBITMQ_USERNAME'] %>
  password: <%= ENV['RABBITMQ_PASSWORD'] %>

development:
  <<: *default

test:
  <<: *default

production:
  <<: *default

Load rails c and then run ActivePublisher.configuration

I get:

 #<ActivePublisher::Configuration:0x6e757f39 @error_handler=#<Proc:0x4e312811@/Users/brian.broderick/.rvm/gems/jruby-9.1.5.0@bellwether/gems/active_publisher-0.1.5-java/lib/active_publisher/configuration.rb:20 (lambda)>, @publisher_confirms=false, @username="guest", @virtual_host="/", @hosts=[], @heartbeat=5, @seconds_to_wait_for_graceful_shutdown=30, @port=5672, @timeout=1, @password="guest", @host="localhost">

I tried using both active_publisher.yml and action_subscriber.yml, but neither file updates the data beyond the defaults.

As a work around (or maybe the solution), I created config/initializers/active_publisher.rb with this:

::ActivePublisher.configure do |config|
  config.host     = ENV["RABBITMQ_HOST"] || "localhost"
  config.port     = ENV["RABBITMQ_PORT"] || 5672
  config.username = ENV["RABBITMQ_USERNAME"]
  config.password = ENV["RABBITMQ_PASSWORD"]
end

which seems to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions