• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bolshakov / stoplight / 14442780381
100%

Build:
DEFAULT BRANCH: master
Ran 14 Apr 2025 09:56AM UTC
Jobs 3
Files 26
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Apr 2025 09:56AM UTC coverage: 100.0%. Remained the same
14442780381

push

github

web-flow
🔧 Configuration API for Stoplight (#295)

Implements a modernized configuration API to make it more maintainable and Ruby-idiomatic. This PR introduces a new configuration system while maintaining backward compatibility.

## What's New?

The biggest change is a new block-based configuration API:

```ruby
Stoplight.configure do |config|
  config.data_store = Stoplight::DataStore::Redis.new(redis)
  config.notifiers = [Stoplight::Notifier::Logger.new(Rails.logger)]
  config.cool_off_time = 30
  config.threshold = 5
  config.window_size = 60
  config.tracked_errors = [NetworkError, TimeoutError]
  config.skipped_errors = [ActiveRecord::RecordNotFound]
end
```

This is much cleaner than the old approach.

## Under the Hood

* Created a configuration provider that properly merges settings from different sources
* Implemented a clear precedence order for settings:
  * Per-light settings (highest priority)
  * User default settings
  * Library default settings

## Deprecation Notice ⚠️

The following methods are now deprecated (they still work but will show deprecation warning):

* `Stoplight.default_data_store = my_data_store`
* `Stoplight.default_notifiers = my_notifiers`
* `Stoplight.default_error_notifier = my_error_handler`

Instead, use the new configuration API shown above.

### Example Usage with Redis

Before:

```ruby
redis = Redis.new
data_store = Stoplight::DataStore::Redis.new(redis)
Stoplight.default_data_store = data_store
Stoplight.default_notifiers += [Stoplight::Notifier::Logger.new(Rails.logger)]
```

After:

```ruby
redis = Redis.new
Stoplight.configure do |config|
  config.data_store = Stoplight::DataStore::Redis.new(redis)
  config.notifiers += [Stoplight::Notifier::Logger.new(Rails.logger)]
end
```

## Why This Change?

* **Single configuration point** - The old API allowed changing Stoplight from many different places in your code, leading to unpredictable behavior. The new block-based approach configures the library as a whole in one... (continued)

108 of 108 new or added lines in 7 files covered. (100.0%)

511 of 511 relevant lines covered (100.0%)

245.85 hits per line

Jobs
ID Job ID Ran Files Coverage
1 ruby-3.3 - 14442780381.1 14 Apr 2025 09:56AM UTC 26
100.0
GitHub Action Run
2 ruby-3.4 - 14442780381.2 14 Apr 2025 09:56AM UTC 26
100.0
GitHub Action Run
3 ruby-3.2 - 14442780381.3 14 Apr 2025 09:56AM UTC 26
100.0
GitHub Action Run
Source Files on build 14442780381
  • Tree
  • List 26
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 3d17865a on github
  • Prev Build on master (#14439399643)
  • Next Build on master (#14464967390)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc