Skip to content

Commit

Permalink
Allow type to be specified by ENV only
Browse files Browse the repository at this point in the history
While we can override the warren type, we still needed it
included in the warren.yml. This was especially annoying when
trying to build assets or similar on the CI.

Note: This does not default to 'log' to avoid silent failures.
  • Loading branch information
James Glover committed Apr 14, 2022
1 parent 5a71fb2 commit b8350c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Unreleased section to make new releases easy.

## [Unreleased]

### Changed

- The WARREN_TYPE environmental variable can now fully replace the config yaml

## [0.4.1] - 2022-01-04

### Changed
Expand Down
2 changes: 1 addition & 1 deletion lib/warren.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Warren
#
# @return [Warren::Handler::Base] Exact class determined by the type passed in
#
def self.construct(type:, config: {})
def self.construct(type: 'UNSPECIFIED', config: {})
warren_type = ENV.fetch(WARREN_TYPE, type)
case warren_type
when 'test' then Warren::Handler::Test.new
Expand Down
4 changes: 2 additions & 2 deletions spec/warren/subscriber/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
expect(subscription).to have_received(:ack).with('delivery_tag')
end

it 'posts the message to the delay exchange' do
it 'posts the message to the delay exchange' do
expect(delayed).to have_received(:publish).with('Hello', routing_key: 'test.key', headers: { attempts: 1 })
end

Expand All @@ -91,7 +91,7 @@
expect(subscription).to have_received(:nack).with('delivery_tag')
end

it 'does not post the message to the delay exchange' do
it 'does not post the message to the delay exchange' do
expect(delayed).not_to have_received(:publish)
end

Expand Down

0 comments on commit b8350c0

Please sign in to comment.