Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple webhooks #189

Open
cveneziani opened this issue Sep 22, 2013 · 2 comments
Open

Multiple webhooks #189

cveneziani opened this issue Sep 22, 2013 · 2 comments
Labels

Comments

@cveneziani
Copy link

Hi,

Is there a way to declare multiple webhooks without having to declare a custom notifier?

Thanks,
Cecile

@jweslley
Copy link
Collaborator

@cveneziani short answer, no. but it can be easily done in different ways

1 - Implementing a MultipleNotifier notifier, which accepts multiple notifiers via configuration hash. This solution turns possible every notifier to have one or more distinct configurations.

Whatever::Application.config.middleware.use ExceptionNotification::Rack,
  :multiple => {
    :notifiers => [
       {:notifier => :webhook, :options => {  :url => 'http://domain.com:5555/hubot/path'  } }
       {:notifier => :webhook, :options => {  :url => 'http://gitlab.domain.com/issues/create'  } }
    ]
  }

2 - Changing the Webhook notifier to accept an array via configuration.

Whatever::Application.config.middleware.use ExceptionNotification::Rack,
  :webhook => {
    :hooks => [
      { :url => 'http://domain.com:5555/hubot/path' },
      { :url => 'http://gitlab.domain.com/issues/create' } 
    ]
  }

3 - Change the ExceptionNotifier class to accept multiple declarations of the same notifier, making this a builtin feature.

Whatever::Application.config.middleware.use ExceptionNotification::Rack,
  :email => {
    :email_prefix => "[Whatever] ",
    :sender_address => %{"notifier" <[email protected]>},
    :exception_recipients => %w{[email protected]}
  },
  :webhook => [
    { :url => 'http://domain.com:5555/hubot/path' },
    { :url => 'http://gitlab.domain.com/issues/create' } 
  ]

/cc @smartinez87

@cveneziani
Copy link
Author

Thanks @jweslley. The third approach seems interesting.

@san650 san650 added the feature label Dec 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants