Rails middleware initialization block I'm working on a simple superfeedr powered rails app here.

Based on the superfeedr-rack gem documentation, I'm doing this to initialize the middleware (snippet from application.rb config block):

Configuration = YAML.load_file(Rails.root.join('config', 'config.yml'))

config.middleware.use Rack::Superfeedr, { :host =&gt; Configuration["general"]["hostname"], :login =&gt; Configuration["superfeedr"]["username"], :password =&gt; Configuration["superfeedr"]["password"]} do |superfeedr|
  Superfeedr = superfeedr
  superfeedr.on_notification do |notification|
    Article.create_from_raw_notification(notification)
  end
end


I'm looking for a better way to do it - I don't like to load my configuration file there instead of in an initializer and I think the block with the article creation callback smells. Any ideas?
Based on tapajos comment, I was able to to refactor the code using initializers. First I created one to load the configuration file:

APP_CONFIG = YAML.load_file(File.expand_path('../../config.yml', __FILE__))


Then I created another initializer, like this:

superfeedr_config =  {
      :host     =&gt; APP_CONFIG["general"]["hostname"],
      :login    =&gt; APP_CONFIG["superfeedr"]["username"],
      :password =&gt; APP_CONFIG["superfeedr"]["password"]
}

Rails.configuration.middleware.use Rack::Superfeedr, superfeedr_config do |superfeedr|
    Superfeedr = superfeedr
    superfeedr.on_notification {|notification| Article.create_from_raw_notification(notification)}
end


I also applied the logic described in this SO question to ensure the load order: How do I change the load order of initializers in Rails 3?.