Add default email validation type to application.yml

This commit is contained in:
Alex Sherman 2020-09-07 16:12:47 +05:00
parent 39a21cb790
commit 87fe230035
2 changed files with 7 additions and 1 deletions

View file

@ -156,6 +156,9 @@ lhv_dev_mode: 'false'
epp_session_timeout_seconds: '300'
# Email validation setting for Truemail gem. Possible values: 'regex', 'mx', 'smtp'
default_email_validation_type: 'regex'
# Since the keys for staging are absent from the repo, we need to supply them separate for testing.
test:
payments_seb_bank_certificate: 'test/fixtures/files/seb_bank_cert.pem'

View file

@ -28,7 +28,10 @@ Truemail.configure do |config|
# Optional parameter. You can predefine default validation type for
# Truemail.validate('email@email.com') call without with-parameter
# Available validation types: :regex, :mx, :smtp
if Rails.env.production?
if ENV['default_email_validation_type'].present? &&
%w[regex, mx, smtp].include?(ENV['default_email_validation_type'])
config.default_validation_type = ENV['default_email_validation_type'].to_sym
elsif Rails.env.production?
config.default_validation_type = :mx
else
config.default_validation_type = :regex