Skip to content

Commit

Permalink
Fixed handler-slack-multichannel.rb (#49)
Browse files Browse the repository at this point in the history
* Fixed handler-slack-multichannel.rb

* Bump version

* Change back the version and add record into changelog

* remove useless function slack_webhook_url
  • Loading branch information
autumnw authored and majormoses committed Aug 18, 2017
1 parent a4b8ca3 commit e0c6a8e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)

## [Unreleased]
## [1.5.0] - 2017-08-18
### Fixed
- `handler-slack-multichannel.rb`: Add param webhook_urls to support one webhook_url per channel

## [1.5.0] - 2017-08-07
### Added
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@
```
{
"slack": {
"webhook_url": "webhook url",
"webhook_urls": {
"no-team-alerts": "https://hooks.slack.com/services/AAAAAAA",
"all-alerts": "https://hooks.slack.com/services/BBBBBB"
},
"channel": {
"default": [ "#no-team-alerts" ],
"compulsory": [ "#all-alerts" ]
"default": [ "no-team-alerts" ],
"compulsory": [ "all-alerts" ]
}
"message_prefix": "optional prefix - can be used for mentions",
"surround": "optional - can be used for bold(*), italics(_), code(`) and preformatted(```)",
Expand Down
9 changes: 5 additions & 4 deletions bin/handler-slack-multichannel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ def slack_icon_url
get_setting('icon_url')
end

def slack_webhook_url
get_setting('webhook_url')
end

def slack_icon_emoji
get_setting('icon_emoji')
end
Expand All @@ -129,6 +125,10 @@ def slack_surround
get_setting('surround')
end

def webhook_urls
get_setting('webhook_urls')
end

def default_channels
return get_setting('channels')['default']
rescue
Expand Down Expand Up @@ -244,6 +244,7 @@ def build_description
end

def post_data(notice, channel)
slack_webhook_url = webhook_urls[channel]
uri = URI(slack_webhook_url)

http = if defined?(slack_proxy_addr).nil?
Expand Down

0 comments on commit e0c6a8e

Please sign in to comment.