-
-
Notifications
You must be signed in to change notification settings - Fork 36
Configuration
Peter Boling edited this page Nov 1, 2016
·
4 revisions
Example Config which expects overrides to be set in environment variables.
file: config/initializers/sanitize_email.rb
SanitizeEmail::Config.configure do |config|
local = Rails.env.development?
if local
missing_env_keys = []
%w(SANITIZE_LOCAL_EMAIL_RECIPIENT SANITIZE_LOCAL_EMAIL_CC SANITIZE_LOCAL_EMAIL_BCC).each do |k|
unless ENV[k]
missing_env_keys << k
end
end
if !missing_env_keys.empty?
message = missing_env_keys.
map {|k| "#{k}={username}@example.org"}.
join("\n")
raise(RuntimeError, "\nPlease set\n\n" << message << "\n\n in your .env.local\n")
end
end
config[:engage] = local
config[:sanitized_to] = ENV['SANITIZE_LOCAL_EMAIL_RECIPIENT']
config[:sanitized_cc] = ENV['SANITIZE_LOCAL_EMAIL_CC']
config[:sanitized_bcc] = ENV['SANITIZE_LOCAL_EMAIL_BCC']
config[:use_actual_email_prepended_to_subject] = true # or false
config[:use_actual_environment_prepended_to_subject] = true # or false
config[:use_actual_email_as_sanitized_user_name] = true # or false
end