From bf84db7f41ea8853ca7f9f4052f68b9a3dabb655 Mon Sep 17 00:00:00 2001 From: David Hollinger Date: Tue, 24 Apr 2018 00:12:22 -0500 Subject: [PATCH] Add app.yml options for slack channel, user, and emoji --- lib/helpers/tasks.rb | 6 +++--- lib/puppet_webhook.rb | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/helpers/tasks.rb b/lib/helpers/tasks.rb index 86a4025..decb069 100644 --- a/lib/helpers/tasks.rb +++ b/lib/helpers/tasks.rb @@ -87,9 +87,9 @@ def notify_slack(status_message) end notifier = Slack::Notifier.new settings.slack_webhook do - defaults channel: '#general', - username: 'puppet_webhook', - icon_emoji: ':ocean:', + defaults channel: settings.slack_channel, + username: settings.slack_user, + icon_emoji: settings.slack_emoji, http_options: http_options end diff --git a/lib/puppet_webhook.rb b/lib/puppet_webhook.rb index 3656dee..0a0a304 100644 --- a/lib/puppet_webhook.rb +++ b/lib/puppet_webhook.rb @@ -38,6 +38,9 @@ class PuppetWebhook < Sinatra::Base # rubocop:disable Style/Documentation set :use_mcollective, false unless settings.respond_to? :use_mcollective= set :discovery_timeout, false unless settings.respond_to? :discovery_timeout= set :slack_webhook, false unless settings.respond_to? :slack_webhook= + set :slack_channel, '#general' unless settings.respond_to? :slack_channel= + set :slack_user, 'puppet_webhook' unless settings.respond_to? :slack_user= + set :slack_emoji, ':ocean:' unless settings.respond_to? :slack_emoji= set :slack_proxy_url, nil unless settings.respond_to? :slack_proxy_url= set :default_branch, 'production' unless settings.respond_to? :default_branch= set :ignore_environments, [] unless settings.respond_to? :ignore_environments=