Add the configuration for the email.
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-04-30 13:03:06 +03:00
parent 72c147cb78
commit a991f63aae
6 changed files with 47 additions and 4 deletions
+30
View File
@@ -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