This gem adds a simple callback interface for Flipper adapter events.
For example, when a Flipper feature is changed, you can:
- send a Slack notification (built-in)
- write the change to a database or log file
- notify a performance monitoring application
- send a YO
Add this line to your application's Gemfile:
gem 'flipper-echo'
And then execute:
$ bundle
Or install it yourself as:
$ gem install flipper-echo
First, configure Flipper as you normally would (any adapter will do), e.g.:
FLIPPER = Flipper.new(Flipper::Adapters::Memory.new)
Then configure this gem in any of the following ways:
Flipper::Echo.configure do |config|
config.flipper = FLIPPER
config.notifier = proc do |event|
# Do something with the event...
#
puts "#{event.feature.name} changed: #{event.action}"
end
end
You can provide any Ruby object with a notify
method:
class CustomNotifier
def notify(event)
# Do something with the event...
end
end
Flipper::Echo.configure do |config|
config.flipper = FLIPPER
config.notifier = CustomNotifier.new
end
Flipper::Echo.configure do |config|
config.flipper = FLIPPER
config.notifiers << NewrelicNotifier.new
config.notifiers << GraphiteNotifier.new
config.notifiers << Flipper::Echo::Stdout::Notifier.new
end
First create a Slack webhook url, then use it in your configuration:
Flipper::Echo.configure do |config|
config.notifiers << Flipper::Echo::Slack::Notifier.new(
'https://hooks.slack.com/your/webhook...', channel: '#eng')
end
http://www.rubydoc.info/github/mode/flipper-echo/master
- Fork it ( https://github.com/mode/flipper-echo/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request