Skip to content

Expose MiddlewareStack#unshift to environment configuration - #12479

Merged
josevalim merged 1 commit into
rails:masterfrom
benpickles:unshift-middleware
Oct 9, 2013
Merged

Expose MiddlewareStack#unshift to environment configuration#12479
josevalim merged 1 commit into
rails:masterfrom
benpickles:unshift-middleware

Conversation

@benpickles

Copy link
Copy Markdown
Contributor

Although #6372 added #unshift to the middleware stack this is not exposed in the environment configuration files.

I wanted to be able to add basic auth to my app and ensure that it was the first middleware to be hit, although I could use #insert_before my stack differs between environments. This change ensures that the following is possible:

config.middleware.unshift Rack::Auth::Basic, 'Restricted Area' do |user, pwd|
  [user, pwd] == ['admin', 'admin']
end

@pftg

pftg commented Oct 9, 2013

Copy link
Copy Markdown
Contributor

To complete this PR need to add Changelog entry.

@benpickles

Copy link
Copy Markdown
Contributor Author

Thanks, I updated the changelog.

@senny

senny commented Oct 9, 2013

Copy link
Copy Markdown
Member

@josevalim I've seen you merged #6372 can you take a look?

josevalim pushed a commit that referenced this pull request Oct 9, 2013
Expose MiddlewareStack#unshift to environment configuration
@josevalim
josevalim merged commit 47ee9fe into rails:master Oct 9, 2013
@josevalim

Copy link
Copy Markdown
Contributor

Thanks @benpickles / @senny / @pftg !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants