Created
December 2, 2020 13:41
-
-
Save tasdikrahman/ced1c8137dfcf756b5fa4664cd5caffe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/jobs/check_certificate_job.rb b/app/jobs/check_certificate_job.rb | |
index 93fb16b..76f995b 100644 | |
+++ b/app/jobs/check_certificate_job.rb | |
--- a/app/jobs/check_certificate_job.rb | |
@@ -10,7 +10,7 @@ class CheckCertificateJob < ApplicationJob | |
Domain.all.each do |domain| | |
if domain.certificate_expiring? | |
Rails.logger.info("#{domain.fqdn} is expiring within the buffer period") | |
+ if (Figaro.env.send_expiry_notifications_to_slack == 'true') && !Figaro.env.slack_webhook_url.empty? | |
- if (Figaro.env.send_expiry_notifications_to_slack == true) && !Figaro.env.slack_webhook_url.empty? | |
message = "Your #{domain.fqdn} is expiring at #{domain.certificate_expiring_not_before}, please renew your cert" | |
slack_notifier = SlackNotifier.new(Figaro.env.slack_webhook_url) | |
begin | |
diff --git a/spec/jobs/check_certificate_job_spec.rb b/spec/jobs/check_certificate_job_spec.rb | |
index f4fa49b..71c40c8 100644 | |
+++ b/spec/jobs/check_certificate_job_spec.rb | |
--- a/spec/jobs/check_certificate_job_spec.rb | |
@@ -48,7 +48,7 @@ RSpec.describe CheckCertificateJob, type: :job do | |
it 'will not call SlackNotifier#notify' do | |
allow_any_instance_of(Domain).to receive(:certificate_expiring?).and_return(true) | |
+ allow(Figaro).to receive_message_chain(:env, :send_expiry_notifications_to_slack).and_return('false') | |
- allow(Figaro).to receive_message_chain(:env, :send_expiry_notifications_to_slack).and_return(false) | |
allow(Figaro).to receive_message_chain(:env, :slack_webhook_url).and_return(slack_webhook_url) | |
expect_any_instance_of(SlackNotifier).not_to receive(:notify).with(anything) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment