From c61981e7957340cbf268d449df809f27555aece6 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Mon, 4 Nov 2019 15:55:08 +0100 Subject: [PATCH] Revert "Sendinblue email balancing using interceptor" This reverts commit b2135b65766299e5550fb88e26cec073ccd7f1f7. --- .../dynamic_smtp_settings_interceptor.rb | 16 ----------- config/env.example | 7 +---- config/environments/development.rb | 28 ++++++------------- config/environments/production.rb | 10 ------- .../dynamic_smtp_settings_interceptor.rb | 1 - config/secrets.yml | 1 - 6 files changed, 9 insertions(+), 54 deletions(-) delete mode 100644 app/models/dynamic_smtp_settings_interceptor.rb delete mode 100644 config/initializers/dynamic_smtp_settings_interceptor.rb diff --git a/app/models/dynamic_smtp_settings_interceptor.rb b/app/models/dynamic_smtp_settings_interceptor.rb deleted file mode 100644 index bbd702420..000000000 --- a/app/models/dynamic_smtp_settings_interceptor.rb +++ /dev/null @@ -1,16 +0,0 @@ -class DynamicSmtpSettingsInterceptor - def self.delivering_email(message) - if ENV['SENDINBLUE_BALANCING'] == 'enabled' - if rand(0..99) < ENV['SENDINBLUE_BALANCING_VALUE'].to_i - message.delivery_method.settings = { - user_name: ENV['SENDINBLUE_USER_NAME'], - password: ENV['SENDINBLUE_CLIENT_KEY'], - address: 'smtp-relay.sendinblue.com', - domain: 'smtp-relay.sendinblue.com', - port: '587', - authentication: :cram_md5 - } - end - end - end -end diff --git a/config/env.example b/config/env.example index 143e586ed..4f704adab 100644 --- a/config/env.example +++ b/config/env.example @@ -46,13 +46,8 @@ SENTRY_DSN_JS="" MATOMO_ENABLED="disabled" MATOMO_ID="73" -SENDINBLUE_BALANCING="" -SENDINBLUE_BALANCING_VALUE="" -SENDINBLUE_ENABLED="" +SENDINBLUE_ENABLED="disabled" SENDINBLUE_CLIENT_KEY="" -SENDINBLUE_USER_NAME="" - - CRISP_ENABLED="disabled" CRISP_CLIENT_KEY="" diff --git a/config/environments/development.rb b/config/environments/development.rb index 1018ab6cf..385185b36 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -45,26 +45,14 @@ Rails.application.configure do config.assets.raise_runtime_errors = true # Action Mailer settings - - if ENV['SENDINBLUE_ENABLED'] == 'enabled' - config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { - user_name: Rails.application.secrets.sendinblue[:username], - password: Rails.application.secrets.sendinblue[:client_key], - address: 'smtp-relay.sendinblue.com', - domain: 'smtp-relay.sendinblue.com', - port: '587', - authentication: :cram_md5 - } - else - config.action_mailer.delivery_method = :letter_opener_web - config.action_mailer.default_url_options = { - host: 'localhost', - port: 3000 - } - - config.action_mailer.asset_host = "http://" + ENV['APP_HOST'] - end + config.action_mailer.delivery_method = :letter_opener_web + # Configure default root URL for generating URLs to routes + config.action_mailer.default_url_options = { + host: 'localhost', + port: 3000 + } + # Configure default root URL for email assets + config.action_mailer.asset_host = "http://" + ENV['APP_HOST'] Rails.application.routes.default_url_options = { host: 'localhost', diff --git a/config/environments/production.rb b/config/environments/production.rb index 38de5db80..8837fb88b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -77,16 +77,6 @@ Rails.application.configure do port: '2525', authentication: :cram_md5 } - elsif ENV['SENDINBLUE_ENABLED'] == 'enabled' - config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { - user_name: Rails.application.secrets.sendinblue[:username], - password: Rails.application.secrets.sendinblue[:client_key], - address: 'smtp-relay.sendinblue.com', - domain: 'smtp-relay.sendinblue.com', - port: '587', - authentication: :cram_md5 - } else config.action_mailer.delivery_method = :mailjet end diff --git a/config/initializers/dynamic_smtp_settings_interceptor.rb b/config/initializers/dynamic_smtp_settings_interceptor.rb deleted file mode 100644 index a3f8e2d13..000000000 --- a/config/initializers/dynamic_smtp_settings_interceptor.rb +++ /dev/null @@ -1 +0,0 @@ -ActionMailer::Base.register_interceptor "DynamicSmtpSettingsInterceptor" diff --git a/config/secrets.yml b/config/secrets.yml index c0989401f..7ad675ffe 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -54,7 +54,6 @@ defaults: &defaults webhook_secret: <%= ENV['HELPSCOUT_WEBHOOK_SECRET'] %> sendinblue: enabled: <%= ENV['SENDINBLUE_ENABLED'] == 'enabled' %> - username: <%= ENV['SENDINBLUE_USER_NAME'] %> client_key: <%= ENV['SENDINBLUE_CLIENT_KEY'] %> api_v3_key: <%= ENV['SENDINBLUE_API_V3_KEY'] %> matomo: