Hello my fellow Rails developers. Any Rack specialist out there?
I have forked out my live app to a staging app whith a dedicated staging environment; for which I’m trying to setup a username/password authentication as per the excellent “Heroku Cookbook” from Mike Coutermarsh. My staging.rb file in the Environment folder looks like:
# Based on production defaults
config.middleware.use '::Rack::Auth::Basic' do |user, password|
[user, password] == ['staging', ENV['STAGING_PASS']]
As soon as I set the Heroku Environment as follows:
RACK_ENV: staging RAILS_ENV: staging
the app crashes miserably.
From the Heroku logs the interesting bits show:
2017-11-26T06:08:07.265653+00:00 app[api]: Set RACK_ENV config vars by user
2017-11-26T06:08:07.265653+00:00 app[api]: Release v63 created by user
2017-11-26T06:08:08.527577+00:00 heroku[web.1]: State changed from crashed to
2017-11-26T06:08:11.994768+00:00 heroku[web.1]: Starting process with command ` bin/rails server -p 9534 -e
2017-11-26T06:08:15.842600+00:00 heroku[web.1]: State changed from starting to
2017-11-26T06:08:15.826934+00:00 heroku[web.1]: Process exited with status 1
5.1.4/lib/action_dispatch/middleware/stack.rb:35:in `build': undefined method ` new' for "::Rack::Auth::Basic":String
2017-11-26T06:08:15.765347+00:00 app[web.1]: Did you mean? next
There must be some error in the following snippet :
I’m not too sure what’s wrong though.
Any idea will be most welcome.