I have the following ActionMailer configuration in production.rb:
unless ENV['APP_NAME'] == 'application-production'
config.action_mailer.preview_path = Rails.root.join('test/mailers/previews')
config.action_mailer.show_previews = true
end
The problem is, non-production apps, such as the staging app, should have http authentication for the whole domain, including the mailer preview path '/rails/mailers' which is now accessible without auth. What's the missing configuration?
EDIT: I tried adding an initializer as per this answer: https://stackoverflow.com/a/44923157/2116456. I would like to use ActionController::Base.http_basic_authenticate_with in the initializer, but it's not available