From f7d109a8516624f92d08eef82fdea265fa3c5f2c Mon Sep 17 00:00:00 2001 From: Bastien Ogier Date: Wed, 6 Sep 2023 11:24:23 +0200 Subject: [PATCH] changed(brevo): use env vars for smtp relay address and port. --- config/env.example.optional | 4 ++++ config/initializers/sendinblue.rb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/env.example.optional b/config/env.example.optional index a2a59e0c035..8935825e999 100644 --- a/config/env.example.optional +++ b/config/env.example.optional @@ -122,6 +122,10 @@ MATOMO_IFRAME_URL="https://matomo.example.org/index.php?module=CoreAdminHome&act # DOLIST_NO_REPLY_EMAIL="" # DOLIST_API_KEY="" +# SMTP Provider: SIB (Brevo) +# SENDINBLUE_SMTP_ADDRESS="" +# SENDINBLUE_SMTP_PORT="" + # Ratio of emails sent using SendInBlue # When present, N % of emails will be sent using SendInBlue # (and the others using the default SMTP provider) diff --git a/config/initializers/sendinblue.rb b/config/initializers/sendinblue.rb index 2d73ffb3084..6defafb3927 100644 --- a/config/initializers/sendinblue.rb +++ b/config/initializers/sendinblue.rb @@ -10,9 +10,9 @@ class SMTP < ::Mail::SMTP; end ActionMailer::Base.sendinblue_settings = { user_name: Rails.application.secrets.sendinblue[:username], password: Rails.application.secrets.sendinblue[:smtp_key], - address: 'smtp-relay.brevo.com', + address: ENV.fetch("SENDINBLUE_SMTP_ADDRESS", "smtp-relay.brevo.com"), domain: 'smtp-relay.brevo.com', - port: '587', + port: ENV.fetch("SENDINBLUE_SMTP_PORT", "587"), authentication: :cram_md5 } end