This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import Config
|
||||
|
||||
require Logger
|
||||
# config/runtime.exs is executed for all environments, including
|
||||
# during releases. It is executed after compilation and before the
|
||||
# system starts, so it is typically used to load production configuration
|
||||
@@ -119,4 +120,33 @@ if config_env() == :prod do
|
||||
# config :swoosh, :api_client, Swoosh.ApiClient.Hackney
|
||||
#
|
||||
# See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
|
||||
|
||||
if System.get_env("SMTP_EMAIL_RELAY") do
|
||||
Logger.info("Using SMTP for email delivery")
|
||||
|
||||
config :decentralised_book_index, DecentralisedBookIndex.Mailer,
|
||||
adapter: Swoosh.Adapters.SMTP,
|
||||
relay: System.get_env("SMTP_EMAIL_RELAY"),
|
||||
username: System.get_env("SMTP_EMAIL_USERNAME"),
|
||||
password: System.get_env("SMTP_EMAIL_PASSWORD"),
|
||||
ssl: true,
|
||||
tls: :always,
|
||||
auth: :always,
|
||||
port: System.get_env("SMTP_EMAIL_PORT"),
|
||||
retries: 2,
|
||||
no_mx_lookups: false
|
||||
|
||||
config :swoosh, :api_client, Swoosh.ApiClient.Finch
|
||||
end
|
||||
|
||||
if System.get_env("SCALEWAY_EMAIL_PROJECT_ID") do
|
||||
Logger.info("Using Scaleway for email delivery")
|
||||
|
||||
config :decentralised_book_index, DecentralisedBookIndex.Mailer,
|
||||
adapter: Swoosh.Adapters.Scaleway,
|
||||
project_id: System.get_env("SCALEWAY_EMAIL_PROJECT_ID"),
|
||||
secret_key: System.get_env("SCALEWAY_EMAIL_SECRET_KEY")
|
||||
|
||||
config :swoosh, :api_client, Swoosh.ApiClient.Finch
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user