Skip to content

Commit

Permalink
Add URL to check mailer
Browse files Browse the repository at this point in the history
  • Loading branch information
brotandgames committed Jun 14, 2023
1 parent 02a922d commit 98c1bd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/mailers/check_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@
class CheckMailer < ApplicationMailer
# Sends mail to inform the receiver about a
# healthcheck status change
# @param name [String] the name of the healthcheck
# @param name [String] the name of the check
# @param url [String] the URL of the check
# @param status_before [String] the old status, `1XX..5XX` or `e`
# @param status_after [String] the new status, `1XX..5XX` or `e`
def change_status_mail
@name = params[:name]
@url = params[:url]
@status_before = params[:status_before]
@status_after = params[:status_after]
mail(subject: "[ciao] #{@name}: Status changed (#{@status_after})")
end

# Sends mail to inform the receiver about a
# expiration of TLS certificate
# @param name [String] the name of the healthcheck
# @param name [String] the name of the check
# @param url [String] the URL of the check
# @param tls_expires_at [DateTime] DateTime when the TLS certificate expires
# @param tls_expires_in_days [Integer] Days until the TLS certificate expires
def tls_expires_mail
@name = params[:name]
@url = params[:url]
@tls_expires_at = params[:tls_expires_at]
@tls_expires_in_days = params[:tls_expires_in_days]
mail(subject: "[ciao] #{@name}: TLS certificate expires in #{@tls_expires_in_days} days")
Expand Down
1 change: 0 additions & 1 deletion config/initializers/create_background_jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
if defined?(Rails::Server) && ActiveRecord::Base.connection.table_exists?('checks')
Check.active.each(&:create_job)
Check.active.each(&:create_tls_job)

end

0 comments on commit 98c1bd9

Please sign in to comment.