-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathsolid_errors.rb
More file actions
37 lines (32 loc) · 1.1 KB
/
solid_errors.rb
File metadata and controls
37 lines (32 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true
require_relative "solid_errors/version"
require_relative "solid_errors/sanitizer"
require_relative "solid_errors/subscriber"
require_relative "solid_errors/engine"
module SolidErrors
mattr_accessor :enabled, default: true
mattr_accessor :connects_to
mattr_accessor :base_controller_class, default: "::ActionController::Base"
mattr_writer :username
mattr_writer :password
mattr_accessor :send_emails, default: false
mattr_accessor :email_from, default: "solid_errors@noreply.com"
mattr_accessor :email_to
mattr_accessor :email_subject_prefix
mattr_accessor :destroy_after
class << self
# use method instead of attr_accessor to ensure
# this works if ENV variable set after SolidErrors is loaded
def username
@username ||= ENV["SOLIDERRORS_USERNAME"] || @@username
end
# use method instead of attr_accessor to ensure
# this works if ENV variable set after SolidErrors is loaded
def password
@password ||= ENV["SOLIDERRORS_PASSWORD"] || @@password
end
def send_emails?
send_emails && email_to.present?
end
end
end