Merge pull request #7232 from betagouv/main

2022-05-02-01
This commit is contained in:
LeSim 2022-05-02 17:23:32 +02:00 committed by GitHub
commit 5db2933239
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,21 +78,35 @@ Rails.application.configure do
if ENV['MAILTRAP_ENABLED'] == 'enabled'
config.action_mailer.delivery_method = :mailtrap
elsif ENV['SENDINBLUE_ENABLED'] == 'enabled' && ENV['SENDINBLUE_BALANCING'] == 'enabled'
ActionMailer::Base.add_delivery_method :balancer, BalancerDeliveryMethod
config.action_mailer.balancer_settings = {
sendinblue: ENV.fetch('SENDINBLUE_BALANCING_VALUE').to_i,
mailjet: 100 - ENV.fetch('SENDINBLUE_BALANCING_VALUE').to_i
}
config.action_mailer.delivery_method = :balancer
elsif ENV['SENDINBLUE_ENABLED'] == 'enabled'
config.action_mailer.delivery_method = :sendinblue
elsif ENV['MAILCATCHER_ENABLED'] == 'enabled'
config.action_mailer.delivery_method = :mailcatcher
else
config.action_mailer.delivery_method = :mailjet
sendinblue_weigth = case [ENV['SENDINBLUE_ENABLED'] == 'enabled', ENV['SENDINBLUE_BALANCING'] == 'enabled']
in [false, _]
0
in [true, false]
100
else
ENV.fetch('SENDINBLUE_BALANCING_VALUE').to_i
end
dolist_weigth = case [ENV['DOLIST_ENABLED'] == 'enabled', ENV['DOLIST_BALANCING'] == 'enabled']
in [false, _]
0
in [true, false]
100
else
ENV.fetch('DOLIST_BALANCING_VALUE').to_i
end
ActionMailer::Base.add_delivery_method :balancer, BalancerDeliveryMethod
config.action_mailer.balancer_settings = {
sendinblue: sendinblue_weigth,
dolist: dolist_weigth,
mailjet: 100 - (sendinblue_weigth + dolist_weigth)
}
config.action_mailer.delivery_method = :balancer
end
# Configure default root URL for generating URLs to routes