Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default email validation type to application.yml #1675

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/application.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 4 additions & 1 deletion config/initializers/truemail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
# Optional parameter. You can predefine default validation type for
# Truemail.validate('[email protected]') 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
Expand Down