From 266fdbabea165224230febb91c894a7f24df0303 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Mon, 2 Nov 2020 09:36:46 -0800 Subject: [PATCH] Omit nil SMTP settings Allows leaving `smtp_settings[:domain]` unspecified. Explicitly setting it to `nil` (as when `OSEM_SMTP_DOMAIN` is unset) overrides the default value of `'localhost.localdomain'` and caused SMTP connections to fail with `EOFError`. --- config/environments/production.rb | 2 +- lib/tasks/migrate_config.rake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 60e023a0..536a8aef 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -97,7 +97,7 @@ Osem::Application.configure do domain: ENV['OSEM_SMTP_DOMAIN'], enable_starttls_auto: ENV['OSEM_SMTP_ENABLE_STARTTLS_AUTO'], openssl_verify_mode: ENV['OSEM_SMTP_OPENSSL_VERIFY_MODE'] - } + }.compact # Set the secret_key_base from the env, if not set by any other means config.secret_key_base ||= ENV["SECRET_KEY_BASE"] diff --git a/lib/tasks/migrate_config.rake b/lib/tasks/migrate_config.rake index 9617dafe..7cd22ade 100644 --- a/lib/tasks/migrate_config.rake +++ b/lib/tasks/migrate_config.rake @@ -34,7 +34,7 @@ namespace :data do dot_env.puts "OSEM_SMTP_USERNAME=\"#{CONFIG['mail_username']}\"" dot_env.puts "OSEM_SMTP_PASSWORD=\"#{CONFIG['mail_password']}\"" dot_env.puts "OSEM_SMTP_AUTHENTICATION=\"#{CONFIG['mail_authentication']}\"" - dot_env.puts 'OSEM_SMTP_DOMAIN=""' + dot_env.puts '# OSEM_SMTP_DOMAIN="example.com"' dot_env.close puts "Migrated config/config.yml to .env.#{Rails.env}"