chore: Fix SMTP mailer config defaults (#1923)

This commit is contained in:
Sojan Jose 2021-03-16 19:40:49 +05:30 committed by GitHub
parent fe8fc570f6
commit e44e9fc025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,16 +13,16 @@ Rails.application.configure do
# Config related to smtp
smtp_settings = {
domain: ENV.fetch('SMTP_DOMAIN', ''),
address: ENV.fetch('SMTP_ADDRESS', 'localhost'),
port: ENV.fetch('SMTP_PORT', 587)
}
smtp_settings[:authentication] = ENV.fetch('SMTP_AUTHENTICATION', 'login').to_sym if ENV.fetch('SMTP_AUTHENTICATION', '').present?
smtp_settings[:authentication] = ENV.fetch('SMTP_AUTHENTICATION', 'login').to_sym if ENV['SMTP_AUTHENTICATION'].present?
smtp_settings[:domain] = ENV['SMTP_DOMAIN'] if ENV['SMTP_DOMAIN'].present?
smtp_settings[:user_name] = ENV['SMTP_USERNAME']
smtp_settings[:password] = ENV['SMTP_PASSWORD']
smtp_settings[:enable_starttls_auto] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_ENABLE_STARTTLS_AUTO', true))
smtp_settings[:openssl_verify_mode] = ENV.fetch('SMTP_OPENSSL_VERIFY_MODE', 'peer')
smtp_settings[:openssl_verify_mode] = ENV['SMTP_OPENSSL_VERIFY_MODE'] if ENV['SMTP_OPENSSL_VERIFY_MODE'].present?
smtp_settings[:ssl] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_SSL', true)) if ENV['SMTP_SSL']
smtp_settings[:tls] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_TLS', true)) if ENV['SMTP_TLS']