Fix Coverband auth and clean up config#167
Merged
JuanVqz merged 4 commits intorailsbump:mainfrom Apr 9, 2026
Merged
Conversation
Coverband::Reporters::Web is a plain Rack app, not Sinatra, so it doesn't respond to .use. Wrap it with Rack::Builder to add Basic Auth. The error only occurred in production because the code was inside an `if Rails.env.production?` guard.
- Use config.password instead of Rack::Builder wrapper for auth - Move config from config/initializers/coverband.rb to config/coverband.rb per Coverband docs - Remove redundant track_views (true by default) - Add config.logger = Rails.logger - Remove unnecessary require "coverband" from routes (Railtie handles it)
Coverband skips auth entirely when password is nil. Use ENV.fetch so the app fails to boot if the var is missing in production, rather than silently exposing coverage data. Skip in dev/test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NoMethodErroronCoverband::Reporters::Web.use(it's a plain Rack app, not Sinatra)config.passwordfor auth instead of a custom Rack middleware wrapperCOVERBAND_PASSWORDenv var in production (app crashes on boot if missing, preventing open access)config/initializers/coverband.rbtoconfig/coverband.rbper Coverband docsconfig.logger = Rails.loggerrequire "coverband"from routes (Railtie handles it)