Hello,
I want to pass a middleware stack to Rails::Engine like Sidekiq or Resque.
How about this implementation?
```
# railties/lib/rails/engine.rb
class Engine < Railtie
def self.use(*args)
if block_given?
middleware.use(*args, &Proc.new)
else
middleware.use(*args)
end
end
end
```
If the above method is implemented, I can use a middleware stack like this.
```
# [rails_root]/config/routes.rb
MyApp::Engine.use Rack::Auth::Basic do |username, password|
username == USER && password == PW
end
mount MyApp::Engine, at: '/my_app'
```
Sidekiq and Resque have an API as below.
```
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
username == USER && password == PW
end
mount Sidekiq::Web, at: "/sidekiq"
```
```
Resque::Server.use Rack::Auth::Basic do |username, password|
username == USER && password == PW
end
mount Resque::Server, at: "/resque"
```
Thanks,
Shinohara
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.