Skip to content

Commit

Permalink
Merge pull request #1 from udzura/specify-attachment-color
Browse files Browse the repository at this point in the history
Add color of attatchment belt option
  • Loading branch information
morygonzalez committed Nov 25, 2015
2 parents 31b8368 + f6bbf59 commit 91b31c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ add below lines to config/initializers/exception_notification.rb.
webhook_url: 'your slack incoming webhook url',
channel: 'channel you want to being notified to',
username: 'slacky',
color: :danger, # optional, default to :danger
addtional_parameters: {
icon_emoji: ':warning:'
}
Expand Down
3 changes: 2 additions & 1 deletion lib/exception_notifier/slacky_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class SlackyNotifier
def initialize(options)
begin
webhook_url = options.fetch(:webhook_url)
@color = options.fetch(:color, :danger)
@message_opts = options.fetch(:additional_parameters, {})
@notifier = Slack::Notifier.new(webhook_url, options)
rescue
Expand Down Expand Up @@ -37,7 +38,7 @@ def valid?
def build_attachemnt(exception, options = {})
{
fallback: "#{exception.class} #{exception.message}",
color: "danger",
color: @color.to_s,
title: "[ERROR] #{exception.class}",
fields: [
{
Expand Down

0 comments on commit 91b31c2

Please sign in to comment.